Skip to contentSkip to conversation

config.c: Remove unused git_config_global() function

PATCH In review Ramsay Jones 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config.c: Remove unused git_config_global() function

Commit 8f323c00 (drop support for GIT_CONFIG_NOGLOBAL, 15-03-2011) removed the git_config_global() function, among other things, since it is no longer required. Unfortunately, this function has since been unintentionally restored; I suspect by merge commit 25b86e45 (Merge branch 'jk/maint-config-alias-fix' into next, 25-05-2011).

---

Hi Junio,

A few days ago, when the next branch was @ d10669c, I noticed that "make sparse" on next was complaining thus:

config.c:828:5: warning: symbol 'git_config_global' was not \
declared. Should it be static?

However, I remembered that this function had recently been removed, so I took a quick look ...

ATB,
Ramsay Jones

 config.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
config.c +0 -5
index a8267e9..e0b3b80 100644
@@ -825,11 +825,6 @@ int git_config_system(void)
 	return !git_env_bool("GIT_CONFIG_NOSYSTEM", 0);
 }
 
-int git_config_global(void)
-{
-	return !git_env_bool("GIT_CONFIG_NOGLOBAL", 0);
-}
-
 int git_config_early(config_fn_t fn, void *data, const char *repo_config)
 {
 	int ret = 0, found = 0;
Signature · 1 line
1.7.5
#1 lore raw
Quoted 5 lines · Ramsay Jones

Commit 8f323c00 (drop support for GIT_CONFIG_NOGLOBAL, 15-03-2011) removed the git_config_global() function, among other things, since it is no longer required. Unfortunately, this function has since been unintentionally restored; I suspect by merge commit 25b86e45 (Merge branch 'jk/maint-config-alias-fix' into next, 25-05-2011).

Yeah, I think it was 1f9a980636 which was a merge between fb674d7 and 73546c0. I just compared the output between these two:

   $ git diff fb674d7...73546c0 -- config.c ;# what the topic did
   $ git diff fb674d7 1f9a980 -- config.c   ;# what was merged

and indeed I can see these four lines snuck in by accidental faulty conflict resolution. My bad.

Thanks for spotting.

#2 lore raw

Effectively navigating branch history (was: Re: [PATCH] config.c: Remove unused git_config_global() function)

----- Original Message -----

Quoted 10 lines

From: "Junio C Hamano" <[email protected]>
Sent: Tuesday, May 31, 2011 1:51:06 PM
Subject: Re: [PATCH] config.c: Remove unused git_config_global() function

Quoted 5 lines

Commit 8f323c00 (drop support for GIT_CONFIG_NOGLOBAL, 15-03-2011) removed the git_config_global() function, among other things, since it is no longer required. Unfortunately, this function has since been unintentionally restored; I suspect by merge commit 25b86e45 (Merge branch 'jk/maint-config-alias-fix' into next, 25-05-2011).

Quoted 5 lines

Yeah, I think it was 1f9a980636 which was a merge between fb674d7 and 73546c0. I just compared the output between these two:

$ git diff fb674d7...73546c0 -- config.c ;# what the topic did
$ git diff fb674d7 1f9a980 -- config.c ;# what was merged

Junio - I'd like to take a chance to learn from a master here if you don't mind. I often find myself wanting to do the "what the topic did" operation but once the branch is merged and deleted, I have difficulty finding useful SHAs to diff.

So in an attempt to educate myself, I tried to track down fb674d7 and 1f9a980 (and failed miserably). I can easily find 8f323c00 using 'git log -S git_config_global', but conceptually I want to trace children of 8f323c00 to see where it merged, and that seems ... complicated. Do you mind walking through your thought process on this problem?

Thanks!
Stephen

#3 lore raw

Re: Effectively navigating branch history

Quoted 6 lines · Stephen Bash
Quoted 5 lines

Yeah, I think it was 1f9a980636 which was a merge between fb674d7 and 73546c0. I just compared the output between these two:

$ git diff fb674d7...73546c0 -- config.c ;# what the topic did
$ git diff fb674d7 1f9a980 -- config.c ;# what was merged
Quoted 6 lines

I often find myself wanting to do the "what the topic did" operation but once the branch is merged and deleted, I have difficulty finding useful SHAs to diff.

So in an attempt to educate myself, I tried to track down fb674d7 and 1f9a980 (and failed miserably).

I just did

    $ git log --first-parent master -- config.c

which was sufficient for my workflow as most of the commits on master are merges from topics and I can see what each topic did from the merge commit summary message.

If I were doing this on a codebase I am not very familiar with, I probably I would have first narrowed things down a bit by

    $ git grep -n -e NOGLOBAL -- config.c ;# to learn the line number 830
    $ git blame -L825,835 -- config.c

to learn where the offending NOGLOBAL came from (it is from ab88c363) so that I can say

    $ git log -m -p -GNOGLOBAL ab88c363.. -- config.c

to find that 1f9a980 reintroduced it by mistake.

#4 lore raw

Re: Effectively navigating branch history

----- Original Message -----

Quoted 17 lines

From: "Junio C Hamano" <[email protected]>
Sent: Tuesday, May 31, 2011 2:40:50 PM
Subject: Re: Effectively navigating branch history

Quoted 6 lines
Quoted 5 lines

Yeah, I think it was 1f9a980636 which was a merge between fb674d7 and 73546c0. I just compared the output between these two:

$ git diff fb674d7...73546c0 -- config.c ;# what the topic did
$ git diff fb674d7 1f9a980 -- config.c ;# what was merged
Quoted 6 lines

I often find myself wanting to do the "what the topic did" operation but once the branch is merged and deleted, I have difficulty finding useful SHAs to diff.

So in an attempt to educate myself, I tried to track down fb674d7 and 1f9a980 (and failed miserably).

Quoted 7 lines

I just did

$ git log --first-parent master -- config.c

which was sufficient for my workflow as most of the commits on master are merges from topics and I can see what each topic did from the merge commit summary message.

Ah, if only our workflow made it that easy... unfortunately it does not ;)

Quoted 6 lines

If I were doing this on a codebase I am not very familiar with, I probably I would have first narrowed things down a bit by

$ git grep -n -e NOGLOBAL -- config.c ;# to learn the line number 830
$ git blame -L825,835 -- config.c
Quoted 6 lines

to learn where the offending NOGLOBAL came from (it is from ab88c363) so that I can say

$ git log -m -p -GNOGLOBAL ab88c363.. -- config.c

to find that 1f9a980 reintroduced it by mistake.

Ah, I was missing the -m! At one point I realized pickaxe was only showing me non-merge commits and skimmed the log manpage to see if there was an option that would enable it but apparently missed -m.

Thanks!

Stephen