Re: git version 1.9.0 missing git-http-push?
Silvola Tuomas wrote > Hello, > > I installed git for windows 1.9.0 but any push operation I tried with it > produced an error message saying "git: 'http-push' is not a git command". > Other commands like pull, add, and commit worked just fine. > At the end of this day I noticed that C:\Program Files > (x86)\Git\libexec\git-core just didn't have the file git-http-push. There > were git-http-backend, git-http-fetch and git-imap-send and such but no > git-http-push. > > I resolved my issue by uninstalling 1.9.0, installing an older version > instead (1.8.1.2; this is when push started working) and 1.9.0 right on > top of the older version. Now git push command works as expected. > > Br, > Tuomas Silvola >From Makefile: curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p) ifeq "$(curl_check)" "070908" ifndef NO_EXPAT PROGRAM_OBJS += http-push.o endif endif if there's no curl-config, http-push.c is silently skipped. This check also doesn't play with cross-compiling when you cannot call curl-config because it is for other arch. There's also a mystic git-http-push$X that is not referenced from anywhere. -- View this message in context: http://git.661346.n2.nabble.com/git-version-1-9-0-missing-git-http-push-tp7608787p7608792.html Sent from the git mailing list archive at Nabble.com. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC/PATCH 1/2] trailer: fix to ignore any line starting with '#'
On Mon, Apr 28, 2014 at 7:58 AM, Michael Haggerty wrote: > On 04/27/2014 10:12 PM, Christian Couder wrote: >> It looks like the commit-msg hook is passed a commit >> message that can contain lines starting with a '#'. >> Those comment lines will be removed from the commit >> message after the hook is run. >> >> If we want "git interpret-trailers" to be able to >> process commit messages correctly in the commit-msg >> hook we need to ignore those lines. > > Shouldn't this take into account the config setting core.commentchar? Yes, I will have a look at that. Thanks, Christian. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] PAGER_ENV: remove 'S' from $LESS by default
By default, Git used to set $LESS to -FRSX if $LESS was not set by the user. The FRX flags actually make sense for Git (F and X because Git sometimes pipes short output to less, and R because Git pipes colored output). The S flag (chop long lines), on the other hand, is not related to Git and is a matter of user preference. Git should not decide for the user to change LESS's default. More specifically, the S flag harms users who review untrusted code within a pager, since a patch looking like: -old code; +new good code; [... lots of tabs ...] malicious code; would appear identical to: -old code; +new good code; Users who prefer the old behavior can still set the $LESS environment variable to -FRSX explicitly, or set core.pager to 'less -S'. The documentation in config.txt is made a bit longer to keep both an example setting the 'S' flag (needed to recover the old behavior) and an example showing how to unset a flag set by Git. Signed-off-by: Matthieu Moy --- > We agree here. So, does someone who actually wants this change want to > propose a patch? :) Here you are. Documentation/config.txt | 13 - Makefile | 6 +++--- perl/Git/SVN/Log.pm | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index e30561d..b7f92ac 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -560,14 +560,17 @@ core.pager:: configuration, then `$PAGER`, and then the default chosen at compile time (usually 'less'). + -When the `LESS` environment variable is unset, Git sets it to `FRSX` +When the `LESS` environment variable is unset, Git sets it to `FRX` (if `LESS` environment variable is set, Git does not change it at all). If you want to selectively override Git's default setting -for `LESS`, you can set `core.pager` to e.g. `less -+S`. This will +for `LESS`, you can set `core.pager` to e.g. `less -S`. This will be passed to the shell by Git, which will translate the final -command to `LESS=FRSX less -+S`. The environment tells the command -to set the `S` option to chop long lines but the command line -resets it to the default to fold long lines. +command to `LESS=FRX less -S`. The environment does not set the +`S` option but the command line does, instructing less to truncate +long lines. Similarly, setting `core.pager` to `less -+F` will +deactivate the `F` option specified by the environment from the +command-line, deactivating the "quit if one screen" behavior of +`less`. + Likewise, when the `LV` environment variable is unset, Git sets it to `-c`. You can override this setting by exporting `LV` with diff --git a/Makefile b/Makefile index a3b298e..cd3cdf6 100644 --- a/Makefile +++ b/Makefile @@ -344,9 +344,9 @@ all:: # Define PAGER_ENV to a SP separated VAR=VAL pairs to define # default environment variables to be passed when a pager is spawned, e.g. # -#PAGER_ENV = LESS=-FRSX LV=-c +#PAGER_ENV = LESS=-FRX LV=-c # -# to say "export LESS=-FRSX (and LV=-c) if the environment variable +# to say "export LESS=-FRX (and LV=-c) if the environment variable # LESS (and LV) is not set, respectively". GIT-VERSION-FILE: FORCE @@ -1518,7 +1518,7 @@ NO_PYTHON = NoThanks endif ifndef PAGER_ENV -PAGER_ENV = LESS=-FRSX LV=-c +PAGER_ENV = LESS=-FRX LV=-c endif QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm index 34f2869..6641053 100644 --- a/perl/Git/SVN/Log.pm +++ b/perl/Git/SVN/Log.pm @@ -116,7 +116,7 @@ sub run_pager { return; } open STDIN, '<&', $rfd or fatal "Can't redirect stdin: $!"; - $ENV{LESS} ||= 'FRSX'; + $ENV{LESS} ||= 'FRX'; $ENV{LV} ||= '-c'; exec $pager or fatal "Can't run pager: $! ($pager)"; } -- 1.9.2.698.ge58c0c2.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Sleep 1 millisecond in poll() to avoid busy wait
From: theoleblond Date: Wed, 16 May 2012 06:52:49 -0700 I played around with this quite a bit. After trying some more complex schemes, I found that what worked best is to just sleep 1 millisecond between iterations. Though it's a very short time, it still completely eliminates the busy wait condition, without hurting perf. There code uses SleepEx(1, TRUE) to sleep. See this page for a good discussion of why that is better than calling SwitchToThread, which is what was used previously: http://stackoverflow.com/questions/1383943/switchtothread-vs-sleep1 Note that calling SleepEx(0, TRUE) does *not* solve the busy wait. The most striking case was when testing on a UNC share with a large repo, on a single CPU machine. Without the fix, it took 4 minutes 15 seconds, and with the fix it took just 1:08! I think it's because git-upload-pack's busy wait was eating the CPU away from the git process that's doing the real work. With multi-proc, the timing is not much different, but tons of CPU time is still wasted, which can be a killer on a server that needs to do bunch of other things. I also tested the very fast local case, and didn't see any measurable difference. On a big repo with 4500 files, the upload-pack took about 2 seconds with and without the fix. --- This is one of the patches that lives in msysGit, could it be accepted upstream? It modifies the Windows compat function only. Have a nice day, Stepan compat/poll/poll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compat/poll/poll.c b/compat/poll/poll.c index 31163f2..c5a9a93 100644 --- a/compat/poll/poll.c +++ b/compat/poll/poll.c @@ -605,7 +605,9 @@ restart: if (!rc && timeout == INFTIM) { - SwitchToThread(); + /* Sleep 1 millisecond to avoid busy wait */ + SleepEx(1, TRUE); + goto restart; } -- 1.9.2.msysgit.0.158.g6070cee -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Jeremy Morton wrote: > On 27/04/2014 09:51, Robin Rosenberg wrote: > >> Currently, git records a checksum, author, commit date/time, and commit > >> message with every commit (as get be seen from 'git log'). I think it > >> would be useful if, along with the Author and Date, git recorded the > >> name of the current branch on each commit. The branch name can provide > >> useful contextual information. For instance, let's say I'm developing a > >> suite of games. If the commit message says "Added basic options > >> dialog", it might be useful to see that the branch name is > >> "pacman-minigame" indicating that the commit pertains to the options > >> dialog in the Pacman minigame. Basically, I'm saying that well-named > >> branches can and do carry useful contextual information that oughtn't to > >> be thrown away. Currently, when you delete that branch, you lose the > >> branch name altogether. > >> > >> So what do you think? Would it be good to have a patch to add this > >> feature? > > > > Branch names are usually poorly named, so often you don't lose much. One way > > Speak for yourself - I give my branches useful names. :-) Me too. > I definitely feel that I am often losing useful contextual information by > throwing away the branch name. I don't. > > some people to is to always merge with --no-ff, that way you see the branch > > name in the merge commit. > > But surely, it's recommended with Git that you try to avoid doing > --no-ff merges to avoid commit noise? Nope. Different people have different needs, there's no recommendation. If anything, the recommendation is to do a ff merge, because that's the default. > Also, it is a lot more hassle (and no doubt, CPU cycles) to track down where > a branch was merged to try and figure out which branch name a commit > pertained to, not to mention the fact that the commit could've been moved > since. Nothing short of tagging the commit with the branch name when the > commit is made will definitely record the branch name at the time of > committing. But why do you need that information? -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] PAGER_ENV: remove 'S' from $LESS by default
Matthieu Moy writes: > By default, Git used to set $LESS to -FRSX if $LESS was not set by the > user. The FRX flags actually make sense for Git (F and X because Git > sometimes pipes short output to less, and R because Git pipes colored > output). The S flag (chop long lines), on the other hand, is not related > to Git and is a matter of user preference. Git should not decide for the > user to change LESS's default. >> We agree here. So, does someone who actually wants this change want to >> propose a patch? :) > > Here you are. > > Documentation/config.txt | 13 - > Makefile | 6 +++--- > perl/Git/SVN/Log.pm | 2 +- > 3 files changed, 12 insertions(+), 9 deletions(-) There seem to be a few more occurences (git-sh-setup.sh and pager.c): $ git grep FRSX Documentation/RelNotes/1.6.5.txt: * mingw will also give FRSX as the default val Documentation/config.txt:When the `LESS` environment variable is unset, Git sets Documentation/config.txt:command to `LESS=FRSX less -+S`. The environment tells git-sh-setup.sh:: ${LESS=-FRSX} pager.c:env[i++] = "LESS=FRSX"; perl/Git/SVN/Log.pm:$ENV{LESS} ||= 'FRSX'; Searching for LESS seems to implicate a few more possible candidates in contrib/examples: contrib/examples/git-log.sh:LESS=-S ${PAGER:-less} contrib/examples/git-whatchanged.sh:LESS="$LESS -S" ${PAGER:-less} -- David Kastrup -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 28/04/2014 09:32, Felipe Contreras wrote: some people to is to always merge with --no-ff, that way you see the branch name in the merge commit. But surely, it's recommended with Git that you try to avoid doing --no-ff merges to avoid commit noise? Nope. Different people have different needs, there's no recommendation. If anything, the recommendation is to do a ff merge, because that's the default. That's what I'm saying. With an ff merge, you don't get the merge commit message telling you the branch name. Also, it is a lot more hassle (and no doubt, CPU cycles) to track down where a branch was merged to try and figure out which branch name a commit pertained to, not to mention the fact that the commit could've been moved since. Nothing short of tagging the commit with the branch name when the commit is made will definitely record the branch name at the time of committing. But why do you need that information? As I said before, I usually consider my branch names useful information worth keeping around - I'm not sure why you don't. I might include a bug# in the branch name so I don't have to keep typing it in every commit message, or I might just have a handy short description of what part of the application this branch is modifying (like my "pacman-minigame" example). -- Best regards, Jeremy Morton (Jez) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git version 1.9.0 missing git-http-push?
On Mon, Apr 28, 2014 at 9:36 AM, Marat Radchenko wrote: > Silvola Tuomas wrote >> Hello, >> >> I installed git for windows 1.9.0 but any push operation I tried with it >> produced an error message saying "git: 'http-push' is not a git command". >> Other commands like pull, add, and commit worked just fine. >> At the end of this day I noticed that C:\Program Files >> (x86)\Git\libexec\git-core just didn't have the file git-http-push. There >> were git-http-backend, git-http-fetch and git-imap-send and such but no >> git-http-push. >> >> I resolved my issue by uninstalling 1.9.0, installing an older version >> instead (1.8.1.2; this is when push started working) and 1.9.0 right on >> top of the older version. Now git push command works as expected. >> >> Br, >> Tuomas Silvola > > From Makefile: > > curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null > | > sort -r | sed -ne 2p) > ifeq "$(curl_check)" "070908" > ifndef NO_EXPAT > PROGRAM_OBJS += http-push.o > endif > endif > > if there's no curl-config, http-push.c is silently skipped. This check also > doesn't play with cross-compiling when you cannot call curl-config because > it is for other arch. > > There's also a mystic git-http-push$X that is not referenced from anywhere. We're using Curl 7.30.0 in msysGit (and thus also Git for Windows), so we should be able to include it. However, we do not have curl-config installed. Looking at 08900987 ("Decide whether to build http-push in the Makefile"), that commit is from 2005, so it seems we've broken something. Further, looking a bit at our curl build-script, we don't seem to to install curl-config. HOWEVER, 37e42ab ("curl: update to 7.28.1 and enable ipv6"), dated 1. Feb 2013 adds a function to remove curl-config. Pat, why is this? My knee-jerk suspicion would be that it's because it's a stale curl-config from a previous install (that *did* install it). However, it doesn't seem like the mingw32 Makefile (the one you get without running configure, it seems) even tries to build curl-config. In fact, it seems this is simply built by configure itself. Which we don't run, again since 37e42ab ("curl: update to 7.28.1 and enable ipv6"). So it seems that 08900987 ("Decide whether to build http-push in the Makefile") makes a bad assumption about the availability of curl-config on new libcurl installations; it's not present on "stock" Windows builds. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 28/04/2014 03:30, Sitaram Chamarty wrote: On 04/28/2014 01:03 AM, Johan Herland wrote: Yeah, sure. Author and Date (and Committer, for that matter) is just metadata, and the current branch name is simply just another kind of metadata. All of them are more-or-less free-form text fields, and off no they're not. In strictly controlled environments they form part of the audit record for the source code. Yes they can be faked (explicitly), but -- again in strictly controlled environments -- that can be limited to "before it was first pushed". Why these specific headers as part of the audit record, though? Aren't you just arbitrarily defining them as part of the audit record? -- Best regards, Jeremy Morton (Jez) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] PAGER_ENV: remove 'S' from $LESS by default
David Kastrup writes: > There seem to be a few more occurences (git-sh-setup.sh and pager.c): Not since f82c3ffd862c7 (Wed Feb 5 2014, move LESS/LV pager environment to Makefile). > Searching for LESS seems to implicate a few more possible candidates in > contrib/examples: > > contrib/examples/git-log.sh:LESS=-S ${PAGER:-less} > contrib/examples/git-whatchanged.sh:LESS="$LESS -S" ${PAGER:-less} Yes, I did see these, but I considered that contrib/examples/ should remain a snapshot of what the commands used to look like at the time they were shell scripts. There's also user-manual.txt: , | Basically, the initial version of `git log` was a shell script: | | | $ git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | \ | LESS=-S ${PAGER:-less} | ` that I left intact. I can change them too if people prefer. Thanks, -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Jeremy Morton wrote: > On 27/04/2014 10:09, Johan Herland wrote: > > On Sun, Apr 27, 2014 at 1:56 AM, Jeremy Morton wrote: > >> Currently, git records a checksum, author, commit date/time, and commit > >> message with every commit (as get be seen from 'git log'). I think it > >> would > >> be useful if, along with the Author and Date, git recorded the name of the > >> current branch on each commit. > > > > This has been discussed multiple times in the past. One example here: > > http://thread.gmane.org/gmane.comp.version-control.git/229422 > > > > I believe the current conclusion (if any) is that encoding such > > information as a _structural_ part of the commit object is not useful. > > See the old thread(s) for the actual pro/con arguments. > > As far as I can tell from that discussion, the general opposition to > encoding the branch name as a structural part of the commit object is > that, for some people's workflows, it would be unhelpful and/or > misleading. s/some people's workflows/most workflows/ > Well fair enough then - why don't we make it a setting that > is off by default, and can easily be switched on? That way the people > for whom tagging the branch name would be useful have a very easy way to > switch it on. I know that for the workflows I personally have used in > the past, such tagging would be very useful. Quite often I have been > looking through the Git log and wondered what feature a commit was "part > of", because I have feature branches. Just knowing that branch name > would be really useful, but the branch has since been deleted... and in > the case of a ff-merge (which I thought was recommended in Git if > possible), the branch name is completely gone. I still don't see why you would need that information, but if you really need it, you can write a commit hook that stores that information in the message, it's very trivial. Also, you can store that information in notes. > You can go back through the history and find "Merge branch > 'pacman-minigame'", but how do you know which commit was the *start* of that > branch, if they are not tagged with the branch name? By recording the start of the branch. [1] https://github.com/felipec/git/commits/fc/tail -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 28/04/2014 07:45, Christian Couder wrote: Yes, it's possible. Yesterday, I sent the following patch: [RFC/PATCH 2/2] trailer: add examples to the documentation and it shows a commit-msg hook to do something like that: $ cat>.git/hooks/commit-msg< "\$1.new" mv "\$1.new" "\$1" EOF $ chmod +x .git/hooks/commit-msg I think you just need to use the following if you want the branch instead of the git version: git interpret-trailers --trim-empty --trailer "git-branch: \$(git name-rev --name-only HEAD)" "\$1"> "\$1.new" It could even be simpler if there was an option (which has already been discussed) that made it possible to modify the file in place. This way one would not need the 'mv "\$1.new" "\$1"' command. Best, Christian. This is certainly going in the right direction, but it's still implemented as a hook on a per-repo basis. Do you foresee a point in the future where these trailers could be added through simple one-liners in someone's global .gitconfig file? That's where I'd really like to get to. -- Best regards, Jeremy Morton (Jez) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git version 1.9.0 missing git-http-push?
On Mon, Apr 28, 2014 at 10:48 AM, Erik Faye-Lund wrote: > So it seems that 08900987 ("Decide whether to build http-push in the > Makefile") makes a bad assumption about the availability of > curl-config on new libcurl installations; it's not present on "stock" > Windows builds. I wonder, though. That check is over 8 years old. Are that old systems (that haven't been upgraded) still able to build Git? Even my old RedHat 5 setup has curl 7.15.5... Perhaps the following is the right thing to do? If not, perhaps we could move this complication to configure.ac, which could get the version number from the header-file instead? That way, quirks only affect quirky systems... (white-space damaged, I'll post a proper patch if there's some agreement) --- diff --git a/Makefile b/Makefile index 29a555d..6da72e7 100644 --- a/Makefile +++ b/Makefile @@ -1133,13 +1133,8 @@ else REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) PROGRAM_OBJS += http-fetch.o PROGRAMS += $(REMOTE_CURL_NAMES) -curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p) -ifeq "$(curl_check)" "070908" -ifndef NO_EXPAT -PROGRAM_OBJS += http-push.o -endif -endif ifndef NO_EXPAT +PROGRAM_OBJS += http-push.o ifdef EXPATDIR BASIC_CFLAGS += -I$(EXPATDIR)/include EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Jeremy Morton writes: > On 28/04/2014 09:32, Felipe Contreras wrote: some people to is to always merge with --no-ff, that way you see the branch name in the merge commit. >>> >>> But surely, it's recommended with Git that you try to avoid doing >>> --no-ff merges to avoid commit noise? >> >> Nope. Different people have different needs, there's no recommendation. If >> anything, the recommendation is to do a ff merge, because that's the default. > > That's what I'm saying. With an ff merge, you don't get the merge > commit message telling you the branch name. And I don't _want_ that branch name to be recorded. The whole point of a distributed version control system is that it's nobody else's business how I organize my work before submitting it. I don't want to have people tell me when submitting patches "but can't you give this a better branch name?" and then have to use git filter-branch or whatever else to get the branch name removed. > As I said before, I usually consider my branch names useful > information worth keeping around - I'm not sure why you don't. It is _totally_ useless information in a distributed development model. Why would or should anybody be concerned what private branches some submitter has developed his patches in? This is not a useful part of a commit. -- David Kastrup -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Sleep 1 millisecond in poll() to avoid busy wait
On Mon, Apr 28, 2014 at 10:39 AM, Stepan Kasal wrote: > From: theoleblond > Date: Wed, 16 May 2012 06:52:49 -0700 > > I played around with this quite a bit. After trying some more complex > schemes, I found that what worked best is to just sleep 1 millisecond > between iterations. Though it's a very short time, it still completely > eliminates the busy wait condition, without hurting perf. > > There code uses SleepEx(1, TRUE) to sleep. See this page for a good > discussion of why that is better than calling SwitchToThread, which > is what was used previously: > http://stackoverflow.com/questions/1383943/switchtothread-vs-sleep1 > > Note that calling SleepEx(0, TRUE) does *not* solve the busy wait. > > The most striking case was when testing on a UNC share with a large repo, > on a single CPU machine. Without the fix, it took 4 minutes 15 seconds, > and with the fix it took just 1:08! I think it's because git-upload-pack's > busy wait was eating the CPU away from the git process that's doing the > real work. With multi-proc, the timing is not much different, but tons of > CPU time is still wasted, which can be a killer on a server that needs to > do bunch of other things. > > I also tested the very fast local case, and didn't see any measurable > difference. On a big repo with 4500 files, the upload-pack took about 2 > seconds with and without the fix. > --- > > This is one of the patches that lives in msysGit, could it be > accepted upstream? > It modifies the Windows compat function only. compat/poll/poll.c comes from Gnulib, so it would be better to submit the patch there and update. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Johan Herland wrote: > On Sun, Apr 27, 2014 at 7:38 PM, Jeremy Morton wrote: > > Whatsmore, tracking down which branch a commit pertains to is still rather > > difficult using this approach. You can go back through the history and > > find "Merge branch 'pacman-minigame'", but how do you know which commit was > > the *start* of that branch, if they are not tagged with the branch name? > > Once you have found the merge commit (M), git log M^1..M^2 should list > all the commits that were made on that branch. The parent of the last > in that list can be considered the starting point for the branch. It's not that easy. There has been a lot of discussion in the mailing list and StackOverflow of ways to do this [1]. The conclusion, at least for me, is that there's no way to find that out, so it has to be recorded. [1] http://thread.gmane.org/gmane.comp.version-control.git/198587 -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On Mon, Apr 28, 2014 at 11:01 AM, Jeremy Morton wrote: > On 28/04/2014 07:45, Christian Couder wrote: >> Yes, it's possible. Yesterday, I sent the following patch: >> >> [RFC/PATCH 2/2] trailer: add examples to the documentation >> >> and it shows a commit-msg hook to do something like that: >> >> $ cat>.git/hooks/commit-msg<> #!/bin/sh >> git interpret-trailers --trim-empty --trailer "git-version: \$(git >> describe)" "\$1"> "\$1.new" >> mv "\$1.new" "\$1" >> EOF >> $ chmod +x .git/hooks/commit-msg >> >> I think you just need to use the following if you want the branch >> instead of the git version: >> >> git interpret-trailers --trim-empty --trailer "git-branch: \$(git name-rev >> --name-only HEAD)" "\$1"> "\$1.new" >> >> It could even be simpler if there was an option (which has already >> been discussed) that made it possible to modify the file in >> place. This way one would not need the 'mv "\$1.new" "\$1"' command. > > This is certainly going in the right direction, but it's still implemented > as a hook on a per-repo basis. Do you foresee a point in the future where > these trailers could be added through simple one-liners in someone's global > .gitconfig file? That's where I'd really like to get to. It's a hack, but it works surprisingly well in practice (assuming that you and your co-workers all agree that this is an acceptable approach): 1. Write the hook script and add it to your project (in a git-hooks subdir or something) 2. Add a post-checkout hook to install the first hook and the post-checkout hook itself into the user's .git/hooks/ dir. 3. Tell your co-workers to run the post-checkout hook script manually the first time. After that, the script should take care of updating itself and any hooks that you add to the project. ...Johan -- Johan Herland, www.herland.net -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 28/04/2014 10:02, David Kastrup wrote: Jeremy Morton writes: On 28/04/2014 09:32, Felipe Contreras wrote: some people to is to always merge with --no-ff, that way you see the branch name in the merge commit. But surely, it's recommended with Git that you try to avoid doing --no-ff merges to avoid commit noise? Nope. Different people have different needs, there's no recommendation. If anything, the recommendation is to do a ff merge, because that's the default. That's what I'm saying. With an ff merge, you don't get the merge commit message telling you the branch name. And I don't _want_ that branch name to be recorded. The whole point of a distributed version control system is that it's nobody else's business how I organize my work before submitting it. Well it would be optional, so obviously you wouldn't be forced to share the branch name. It's not like we're trying to "pry in" to your private development. It's a way of choosing to share what you may consider to be useful contextual information about the commit. I don't want to have people tell me when submitting patches "but can't you give this a better branch name?" and then have to use git filter-branch or whatever else to get the branch name removed. As I said before, I usually consider my branch names useful information worth keeping around - I'm not sure why you don't. It is _totally_ useless information in a distributed development model. Why would or should anybody be concerned what private branches some submitter has developed his patches in? Why should anybody be concerned about what commit message some submitter has typed in for his commit? They could just read the source code to see what has changed, right? Because the commit message is a way for the submitter to try and make it easier for the people looking at the commit to understand what the commit is doing. In the same way, a meaningful branch name may also make it easier for people looking at the commit to understand what it is doing, or what part of the application it is affecting, or what group of commits it is a part of. -- Best regards, Jeremy Morton (Jez) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Jeremy Morton wrote: > On 27/04/2014 20:33, Johan Herland wrote: > > The problem is not really "less tidy commit trees" - by which I gather > > you mean history graphs that are non-linear. IMHO, the history graph > > should reflect parallel/branched development when that is useful. > > Blindly rebasing everything into a single line is IMHO just as bad as > > doing all your work directly on master and blindly running "git pull" > > between each of your own commits (which results in a lot of useless > > merges). The merge commits themselves are not the problem. Merge > > commits are a tool, and when used properly (to introduce topics to the > > master branch like described above) they are a good tool. When abused > > (like blindly running "git pull" and accepting useless "merge > > bubbles") they create more problems than they solve. > > Sounds like the default behaviour of "git pull" might not be ideal if it > easily causes these problems. It's not idea. Virtually everyone agrees with that, even Linus Torvalds, and we have the patches to fix it, but it's not going to change. The Git project doesn't welcome change. -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 28/04/2014 10:09, Johan Herland wrote: On Mon, Apr 28, 2014 at 11:01 AM, Jeremy Morton wrote: On 28/04/2014 07:45, Christian Couder wrote: Yes, it's possible. Yesterday, I sent the following patch: [RFC/PATCH 2/2] trailer: add examples to the documentation and it shows a commit-msg hook to do something like that: $ cat>.git/hooks/commit-msg< "\$1.new" mv "\$1.new" "\$1" EOF $ chmod +x .git/hooks/commit-msg I think you just need to use the following if you want the branch instead of the git version: git interpret-trailers --trim-empty --trailer "git-branch: \$(git name-rev --name-only HEAD)" "\$1"> "\$1.new" It could even be simpler if there was an option (which has already been discussed) that made it possible to modify the file in place. This way one would not need the 'mv "\$1.new" "\$1"' command. This is certainly going in the right direction, but it's still implemented as a hook on a per-repo basis. Do you foresee a point in the future where these trailers could be added through simple one-liners in someone's global .gitconfig file? That's where I'd really like to get to. It's a hack, but it works surprisingly well in practice (assuming that you and your co-workers all agree that this is an acceptable approach): 1. Write the hook script and add it to your project (in a git-hooks subdir or something) 2. Add a post-checkout hook to install the first hook and the post-checkout hook itself into the user's .git/hooks/ dir. 3. Tell your co-workers to run the post-checkout hook script manually the first time. After that, the script should take care of updating itself and any hooks that you add to the project. ...Johan I don't understand why the co-workers need to run the post-checkout hook script manually the first time? -- Best regards, Jeremy Morton (Jez) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 28/04/2014 10:01, Felipe Contreras wrote: Jeremy Morton wrote: On 27/04/2014 20:33, Johan Herland wrote: The problem is not really "less tidy commit trees" - by which I gather you mean history graphs that are non-linear. IMHO, the history graph should reflect parallel/branched development when that is useful. Blindly rebasing everything into a single line is IMHO just as bad as doing all your work directly on master and blindly running "git pull" between each of your own commits (which results in a lot of useless merges). The merge commits themselves are not the problem. Merge commits are a tool, and when used properly (to introduce topics to the master branch like described above) they are a good tool. When abused (like blindly running "git pull" and accepting useless "merge bubbles") they create more problems than they solve. Sounds like the default behaviour of "git pull" might not be ideal if it easily causes these problems. It's not idea. Virtually everyone agrees with that, even Linus Torvalds, and we have the patches to fix it, but it's not going to change. The Git project doesn't welcome change. Well, you sure don't seem to. Why are there so many "no-can-do" people on this list? :-) -- Best regards, Jeremy Morton (Jez) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Jeremy Morton wrote: > On 28/04/2014 10:01, Felipe Contreras wrote: > > Jeremy Morton wrote: > >> On 27/04/2014 20:33, Johan Herland wrote: > >>> The problem is not really "less tidy commit trees" - by which I gather > >>> you mean history graphs that are non-linear. IMHO, the history graph > >>> should reflect parallel/branched development when that is useful. > >>> Blindly rebasing everything into a single line is IMHO just as bad as > >>> doing all your work directly on master and blindly running "git pull" > >>> between each of your own commits (which results in a lot of useless > >>> merges). The merge commits themselves are not the problem. Merge > >>> commits are a tool, and when used properly (to introduce topics to the > >>> master branch like described above) they are a good tool. When abused > >>> (like blindly running "git pull" and accepting useless "merge > >>> bubbles") they create more problems than they solve. > >> > >> Sounds like the default behaviour of "git pull" might not be ideal if it > >> easily causes these problems. > > > > It's not idea. Virtually everyone agrees with that, even Linus Torvalds, > > and we > > have the patches to fix it, but it's not going to change. > > > > The Git project doesn't welcome change. > > Well, you sure don't seem to. Why are there so many "no-can-do" people > on this list? :-) I don't seem to what? I'm the one arguing for change, and I sent the patches to fix this default behavior. -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 28/04/2014 10:17, Felipe Contreras wrote: I don't seem to what? I'm the one arguing for change, and I sent the patches to fix this default behavior. Well maybe you should work on phrasing things better - you come across as quite negative. -- Best regards, Jeremy Morton (Jez) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git version 1.9.0 missing git-http-push?
On Mon, Apr 28, 2014 at 11:01 AM, Erik Faye-Lund wrote: > On Mon, Apr 28, 2014 at 10:48 AM, Erik Faye-Lund wrote: >> So it seems that 08900987 ("Decide whether to build http-push in the >> Makefile") makes a bad assumption about the availability of >> curl-config on new libcurl installations; it's not present on "stock" >> Windows builds. > > I wonder, though. That check is over 8 years old. Are that old systems > (that haven't been upgraded) still able to build Git? Even my old > RedHat 5 setup has curl 7.15.5... > > Perhaps the following is the right thing to do? If not, perhaps we > could move this complication to configure.ac, which could get the > version number from the header-file instead? That way, quirks only > affect quirky systems... And here's a stab at that. Not really tested, as I don't have an affected system, so it's probably broken somehow ;) But if someone want's to pick it up, at least there's a starting-point. --- diff --git a/Makefile b/Makefile index 29a555d..b94f830 100644 --- a/Makefile +++ b/Makefile @@ -1133,11 +1133,8 @@ else REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) PROGRAM_OBJS += http-fetch.o PROGRAMS += $(REMOTE_CURL_NAMES) - curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p) - ifeq "$(curl_check)" "070908" - ifndef NO_EXPAT - PROGRAM_OBJS += http-push.o - endif + ifndef NO_CAPABLE_CURL + PROGRAM_OBJS += http-push.o endif ifndef NO_EXPAT ifdef EXPATDIR diff --git a/configure.ac b/configure.ac index 2f43393..47991c0 100644 --- a/configure.ac +++ b/configure.ac @@ -513,6 +513,16 @@ AC_CHECK_LIB([curl], [curl_global_init], [NO_CURL=], [NO_CURL=YesPlease]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include ], + [#if LIBCURL_VERSION_NUM < 0x070908 +#error version too old +#endif + ])], + [NO_CAPABLE_CURL=YesPlease], + [NO_CAPABLE_CURL=]) +GIT_CONF_SUBST([NO_CAPABLE_CURL]) + GIT_UNSTASH_FLAGS($CURLDIR) GIT_CONF_SUBST([NO_CURL]) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 04/28/2014 02:22 PM, Jeremy Morton wrote: On 28/04/2014 03:30, Sitaram Chamarty wrote: On 04/28/2014 01:03 AM, Johan Herland wrote: Yeah, sure. Author and Date (and Committer, for that matter) is just metadata, and the current branch name is simply just another kind of metadata. All of them are more-or-less free-form text fields, and off no they're not. In strictly controlled environments they form part of the audit record for the source code. Yes they can be faked (explicitly), but -- again in strictly controlled environments -- that can be limited to "before it was first pushed". Why these specific headers as part of the audit record, though? Aren't you just arbitrarily defining them as part of the audit record? "who did it" and "when did they do it" are a fair bit more central to "how did we get here" (viz., the SHA1 of the top commit, if you will) than "what branch was this commit born in (or similar)". Here's an example from somewhere I worked (indirectly) in the late 90s. Nasty bug, easily fixable (a few characters to change). Customer group all p-ed off. Developer has access to the version control server. He changes something on the VC system to appear as if the bug never existed in the version of the code he shipped to whoever. As a result, the bug was deemed to have "mysteriously" appeared somewhere along the line. It didn't help that parts of the workflow were semi-manual, so he *did* have vague things to point at. I don't believe I can explain that any better or go into details without some risk, so if you don't agree then that's all there is to it. Suffice it to say I am strongly opposed to the idea, but as long as it's optional -- and for the right reasons (see my other email) -- I'd be OK. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
On 04/28/2014 11:37 AM, David Kastrup wrote: Johan Herland writes: Obviously, the feature would necessarily have to be optional, simply because Git would have to keep understanding the old commit object format for a LONG time (probably indefinitely), and there's nothing you can do to prevent others from creating old-style commit objects. Johan: I seem to have missed your previous email (fat-fingered something on my mail client I expect). Your **reasons** for making it optional are all wrong. People like me (and David) who are opposed to this run the risk that if the **format** were to officially change in some way or for some reason (like, say, if SHA1 is no longer in favour, or whatever), then this "feature" is foisted on us willy-nilly. That's not good. So, while I appreciate your point that it should be optional, please let's accept that in the end it should be optional because **not everyone likes it**! Personally, I am _strongly_ opposed. How I name and juggle my private branches is nobody else's business in a distributed version control system. They are private. My personal workflow. Not part of a commit. Hear hear!! -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v10 11/12] Documentation: add documentation for 'git interpret-trailers'
On 04/25/2014 11:07 PM, Christian Couder wrote: > From: Michael Haggerty > +OPTIONS > +--- > +--trim-empty:: > + If the 'value' part of any trailer contains only whitespace, > + the whole trailer will be removed from the resulting message. Does this apply to existing trailers, new trailers, or both? >>> >>> Both. >>> If it applies to existing trailers, then it seems a bit dangerous, in the sense that the command might end up changing trailers that are unrelated to the one that the command is trying to add. >>> >>> The command is not just for adding trailers. >>> But there could be an option to just trim trailers that are added. >> >> Maybe that should be the *only* behavior of this option. >> >> Maybe there should be a trailer..trimEmpty config option. > > One possible usage of the "git interpret-trailers" command that was > discussed in the early threads was the following: > > 1) You have a commit message template like the following: > > - > ***SUBJECT*** > > ***MESSAGE*** > > Fixes: > Cc: > Cc: > Reviewed-by: > Reviewed-by: > Signed-off-by: > - > [...etc...] Thanks for the explanation. Now the --trim-empty option makes a lot more sense. If a commit message containing trailer lines with separators other than ':' is input to the program, will it recognize them as trailer lines? >>> >>> No, '=' and '#' are not supported in the input message, only in the output. >>> Do such trailer lines have to have the same separator as the one listed in this configuration setting to be recognized? >>> >>> No they need to have ':' as a separator. >>> >>> The reason why only ':' is supported is because it is the cannonical >>> trailer separator and it could create problems with many input >>> messages if other separators where supported. >>> >>> Maybe we could detect a special line like the following: >>> >>> # TRAILERS START >>> >>> in the input message and consider everyhting after that line as trailers. >>> In this case it would be ok to accept other separators. >> >> It would be ugly to have to use such a line. I think it would be >> preferable to be more restrictive about trailer separators than to >> require something like this. > > The code is already very restrictive about trailer separators. > >> From what you've said above, it sounds like your code might get confused >> with the following input commit message: >> >> This is the human-readable comment >> >> Foo: bar >> Fixes #123 >> Plugh: xyzzy >> >> It seems to me that none of these lines would be accepted as trailers, >> because they include a non-trailer "Fixes" line (non-trailer in the >> sense that it doesn't use a colon separator). > > Yeah, they would not be accepted because the code is very restrictive. > > The following would be accepted: > > Foo: bar > Fixes: 123 > Plugh: xyzzy > I suppose that there is some compelling reason to allow non-colon separators here. If not, it seems like it adds a lot of complexity and should maybe be omitted, or limited to only a few specific separators. >>> >>> Yeah, but in the early threads concerning this subject, someone said >>> that GitHub for example uses "bug #XXX". >>> I will have a look again. >> >> Yes, that's true: GitHub recognizes strings like "fixes #33" but not if >> there is an intervening colon like in "fixes: #33". OTOH GitHub >> recognizes such strings wherever they appear in the commit message (they >> don't have to be in "trailer" lines). So I'm not sure that the added >> complication is worth it if GitHub is the only use case. (And maybe we >> could convince GitHub to recognize "Fixes: #33" if such syntax becomes >> the de-facto Git standard for trailers.) > > I don't think there is a lot of complexity. > But maybe I need to explain how it works better. > Feel free to suggest me sentences I could add. I am really excited about having better support for trailers in Git, and I want to thank you for your work. For me the promise of trailers is * A way for users to add information to commits for whatever purpose they want, without having to convince upstream to built support in. * A standard format for that information, so that all tools can agree how to read/write trailers without being confused by or breaking trailers that they didn't know about in advance. * A format that is straightforward enough that it can be machine- readable with minimum ambiguity. * Some command-line tools to make it easy for scripts to work with trailers, and that serve as a reference implementation that other Git implementations can imitate. For example, I totally expect that we will soon want a command-line tool for inquiring about the presence and contents of trailers, for use in scripting. Eventually we will want to be able to do stuff like git trailers --get-all s-o-b origin/master..origin/next git rev-list
[PATCH 04/32] read-cache: new API write_locked_index instead of write_index/write_cache
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/add.c| 6 ++ builtin/apply.c | 9 - builtin/checkout-index.c | 3 +-- builtin/checkout.c | 11 --- builtin/clone.c | 7 +++ builtin/commit.c | 33 ++--- builtin/merge.c | 12 builtin/mv.c | 7 +++ builtin/read-tree.c | 7 +++ builtin/reset.c | 5 ++--- builtin/rm.c | 7 +++ builtin/update-index.c | 3 +-- cache-tree.c | 3 +-- cache.h | 6 -- merge-recursive.c| 7 +++ merge.c | 7 +++ read-cache.c | 28 rerere.c | 3 +-- sequencer.c | 12 +--- test-scrap-cache-tree.c | 5 ++--- 20 files changed, 87 insertions(+), 94 deletions(-) diff --git a/builtin/add.c b/builtin/add.c index 459208a..4baf3a5 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -299,7 +299,6 @@ static int add_files(struct dir_struct *dir, int flags) int cmd_add(int argc, const char **argv, const char *prefix) { int exit_status = 0; - int newfd; struct pathspec pathspec; struct dir_struct dir; int flags; @@ -345,7 +344,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) add_new_files = !take_worktree_changes && !refresh_only; require_pathspec = !take_worktree_changes; - newfd = hold_locked_index(&lock_file, 1); + hold_locked_index(&lock_file, 1); flags = ((verbose ? ADD_CACHE_VERBOSE : 0) | (show_only ? ADD_CACHE_PRETEND : 0) | @@ -443,8 +442,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) finish: if (active_cache_changed) { - if (write_cache(newfd, active_cache, active_nr) || - commit_locked_index(&lock_file)) + if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) die(_("Unable to write new index file")); } diff --git a/builtin/apply.c b/builtin/apply.c index 87439fa..5e13444 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3644,7 +3644,7 @@ static void build_fake_ancestor(struct patch *list, const char *filename) { struct patch *patch; struct index_state result = { NULL }; - int fd; + static struct lock_file lock; /* Once we start supporting the reverse patch, it may be * worth showing the new sha1 prefix, but until then... @@ -3682,8 +3682,8 @@ static void build_fake_ancestor(struct patch *list, const char *filename) die ("Could not add %s to temporary index", name); } - fd = open(filename, O_WRONLY | O_CREAT, 0666); - if (fd < 0 || write_index(&result, fd) || close(fd)) + hold_lock_file_for_update(&lock, filename, LOCK_DIE_ON_ERROR); + if (write_locked_index(&result, &lock, COMMIT_LOCK)) die ("Could not write temporary index to %s", filename); discard_index(&result); @@ -4501,8 +4501,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) } if (update_index) { - if (write_cache(newfd, active_cache, active_nr) || - commit_locked_index(&lock_file)) + if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) die(_("Unable to write new index file")); } diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 61e75eb..9e49bf2 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -279,8 +279,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) checkout_all(prefix, prefix_length); if (0 <= newfd && - (write_cache(newfd, active_cache, active_nr) || -commit_locked_index(&lock_file))) + write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) die("Unable to write new index file"); return 0; } diff --git a/builtin/checkout.c b/builtin/checkout.c index 07cf555..944a634 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -225,7 +225,6 @@ static int checkout_paths(const struct checkout_opts *opts, int flag; struct commit *head; int errs = 0; - int newfd; struct lock_file *lock_file; if (opts->track != BRANCH_TRACK_UNSPECIFIED) @@ -256,7 +255,7 @@ static int checkout_paths(const struct checkout_opts *opts, lock_file = xcalloc(1, sizeof(struct lock_file)); - newfd = hold_locked_index(lock_file, 1); + hold_locked_index(lock_file, 1); if (read_cache_preload(&opts->pathspec) < 0) return error(_("corrupt index file")); @@ -352,8 +351,7 @@ static int checkout_paths(const struct checkout_opts *opts, } } - if (write_cache(newfd, active_cache
[PATCH 00/32] Split index mode for very large indexes
I hinted about it earlier [1]. It now passes the test suite and with a design that I'm happy with (thanks to Junio for a suggestion about the rename problem). >From the user point of view, this reduces the writable size of index down to the number of updated files. For example my webkit index v4 is 14MB. With a fresh split, I only have to update an index of 200KB. Every file I touch will add about 80 bytes to that. As long as I don't touch every single tracked file in my worktree, I should not pay penalty for writing 14MB index file on every operation. The read penalty is not addressed here, so I still pay 14MB hashing cost. But that's an easy problem. We could cache the validated index in a daemon. Whenever git needs to load an index, it pokes the daemon. The daemon verifies that the on-disk index still has the same signature, then sends the in-mem index to git. When git updates the index, it pokes the daemon again to update in-mem index. Next time git reads the index, it does not have to pay I/O cost any more (actually it does but the cost is hidden away when you do not have to read it yet). The forth patch is not really necessary. I started out with a different approach that needed that abstraction. But I think it's still a nice thing to keep. The real meat starts from 0017 to 0025. In essence, the new index is more like a journal, where the real index is put away unchanged. Doing this in other implementations should be easy (at least the reading part) and with small code change. The whole index format is retained. All you need is to read a new extension that contains two ewah-bitmaps and apply the changes to create the final index. This is a preparation step for my untracked file cache. With writing (and later on reading) index becoming cheap, I can start to put more things in there. [1] http://thread.gmane.org/gmane.comp.version-control.git/246471/focus=247031 Nguyễn Thái Ngọc Duy (32): ewah: fix constness of ewah_read_mmap ewah: delete unused ewah_read_mmap_native declaration sequencer: do not update/refresh index if the lock cannot be held read-cache: new API write_locked_index instead of write_index/write_cache read-cache: relocate and unexport commit_locked_index() read-cache: store in-memory flags in the first 12 bits of ce_flags read-cache: be strict about "changed" in remove_marked_cache_entries() read-cache: be specific what part of the index has changed update-index: be specific what part of the index has changed resolve-undo: be specific what part of the index has changed unpack-trees: be specific what part of the index has changed cache-tree: mark istate->cache_changed on cache tree invalidation cache-tree: mark istate->cache_changed on cache tree update cache-tree: mark istate->cache_changed on prime_cache_tree() entry.c: update cache_changed if refresh_cache is set in checkout_entry() read-cache: save index SHA-1 after reading read-cache: split-index mode read-cache: mark new entries for split index read-cache: save deleted entries in split index read-cache: mark updated entries for split index split-index: the writing part split-index: the reading part split-index: do not invalidate cache-tree at read time split-index: strip pathname of on-disk replaced entries update-index: new options to enable/disable split index mode update-index --split-index: do not split if $GIT_DIR is read only rev-parse: add --shared-index-path to get shared index path read-tree: force split-index mode off on --index-output read-tree: note about dropping split-index mode or index version read-cache: force split index mode with GIT_TEST_SPLIT_INDEX t2104: make sure split index mode is off for the version test t1700: new tests for split-index mode -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/32] sequencer: do not update/refresh index if the lock cannot be held
Signed-off-by: Nguyễn Thái Ngọc Duy --- sequencer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index bde5f04..7b886a6 100644 --- a/sequencer.c +++ b/sequencer.c @@ -679,7 +679,7 @@ static void read_and_refresh_cache(struct replay_opts *opts) if (read_index_preload(&the_index, NULL) < 0) die(_("git %s: failed to read the index"), action_name(opts)); refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL); - if (the_index.cache_changed) { + if (the_index.cache_changed && index_fd >= 0) { if (write_index(&the_index, index_fd) || commit_locked_index(&index_lock)) die(_("git %s: failed to refresh the index"), action_name(opts)); -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/32] ewah: fix constness of ewah_read_mmap
Signed-off-by: Nguyễn Thái Ngọc Duy --- ewah/ewah_io.c | 4 ++-- ewah/ewok.h| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ewah/ewah_io.c b/ewah/ewah_io.c index f7f700e..1c2d7af 100644 --- a/ewah/ewah_io.c +++ b/ewah/ewah_io.c @@ -110,9 +110,9 @@ int ewah_serialize(struct ewah_bitmap *self, int fd) return ewah_serialize_to(self, write_helper, (void *)(intptr_t)fd); } -int ewah_read_mmap(struct ewah_bitmap *self, void *map, size_t len) +int ewah_read_mmap(struct ewah_bitmap *self, const void *map, size_t len) { - uint8_t *ptr = map; + const uint8_t *ptr = map; size_t i; self->bit_size = get_be32(ptr); diff --git a/ewah/ewok.h b/ewah/ewok.h index 43adeb5..0556ca5 100644 --- a/ewah/ewok.h +++ b/ewah/ewok.h @@ -99,7 +99,7 @@ int ewah_serialize(struct ewah_bitmap *self, int fd); int ewah_serialize_native(struct ewah_bitmap *self, int fd); int ewah_deserialize(struct ewah_bitmap *self, int fd); -int ewah_read_mmap(struct ewah_bitmap *self, void *map, size_t len); +int ewah_read_mmap(struct ewah_bitmap *self, const void *map, size_t len); int ewah_read_mmap_native(struct ewah_bitmap *self, void *map, size_t len); uint32_t ewah_checksum(struct ewah_bitmap *self); -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/32] read-cache: relocate and unexport commit_locked_index()
This function is now only used by write_locked_index(). Move it to read-cache.c (because read-cache.c will need to be aware of alternate_index_output later) and unexport it. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 1 - lockfile.c | 20 read-cache.c | 20 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cache.h b/cache.h index 9cc2b97..e44048c 100644 --- a/cache.h +++ b/cache.h @@ -552,7 +552,6 @@ extern int commit_lock_file(struct lock_file *); extern void update_index_if_able(struct index_state *, struct lock_file *); extern int hold_locked_index(struct lock_file *, int); -extern int commit_locked_index(struct lock_file *); extern void set_alternate_index_output(const char *); extern int close_lock_file(struct lock_file *); extern void rollback_lock_file(struct lock_file *); diff --git a/lockfile.c b/lockfile.c index 8fbcb6a..b706614 100644 --- a/lockfile.c +++ b/lockfile.c @@ -5,7 +5,6 @@ #include "sigchain.h" static struct lock_file *lock_file_list; -static const char *alternate_index_output; static void remove_lock_file(void) { @@ -252,25 +251,6 @@ int hold_locked_index(struct lock_file *lk, int die_on_error) : 0); } -void set_alternate_index_output(const char *name) -{ - alternate_index_output = name; -} - -int commit_locked_index(struct lock_file *lk) -{ - if (alternate_index_output) { - if (lk->fd >= 0 && close_lock_file(lk)) - return -1; - if (rename(lk->filename, alternate_index_output)) - return -1; - lk->filename[0] = 0; - return 0; - } - else - return commit_lock_file(lk); -} - void rollback_lock_file(struct lock_file *lk) { if (lk->filename[0]) { diff --git a/read-cache.c b/read-cache.c index 44d4732..576e506 100644 --- a/read-cache.c +++ b/read-cache.c @@ -36,6 +36,7 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, #define CACHE_EXT_RESOLVE_UNDO 0x52455543 /* "REUC" */ struct index_state the_index; +static const char *alternate_index_output; static void set_index_entry(struct index_state *istate, int nr, struct cache_entry *ce) { @@ -1875,6 +1876,25 @@ static int do_write_index(struct index_state *istate, int newfd) return 0; } +void set_alternate_index_output(const char *name) +{ + alternate_index_output = name; +} + +static int commit_locked_index(struct lock_file *lk) +{ + if (alternate_index_output) { + if (lk->fd >= 0 && close_lock_file(lk)) + return -1; + if (rename(lk->filename, alternate_index_output)) + return -1; + lk->filename[0] = 0; + return 0; + } + else + return commit_lock_file(lk); +} + static int do_write_locked_index(struct index_state *istate, struct lock_file *lock, unsigned flags) { -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/32] resolve-undo: be specific what part of the index has changed
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h| 1 + resolve-undo.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cache.h b/cache.h index 4133797..7155052 100644 --- a/cache.h +++ b/cache.h @@ -272,6 +272,7 @@ static inline unsigned int canon_mode(unsigned int mode) #define CE_ENTRY_REMOVED (1 << 1) #define CE_ENTRY_ADDED (1 << 2) #define SOMETHING_CHANGED (1 << 3) /* unclassified changes go here */ +#define RESOLVE_UNDO_CHANGED (1 << 4) struct index_state { struct cache_entry **cache; diff --git a/resolve-undo.c b/resolve-undo.c index 44c697c..468a2eb 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -110,7 +110,7 @@ void resolve_undo_clear_index(struct index_state *istate) string_list_clear(resolve_undo, 1); free(resolve_undo); istate->resolve_undo = NULL; - istate->cache_changed = 1; + istate->cache_changed |= RESOLVE_UNDO_CHANGED; } int unmerge_index_entry_at(struct index_state *istate, int pos) -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/32] read-cache: be specific what part of the index has changed
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 4 read-cache.c | 11 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cache.h b/cache.h index 57ad318..d692b74 100644 --- a/cache.h +++ b/cache.h @@ -268,6 +268,10 @@ static inline unsigned int canon_mode(unsigned int mode) #define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1) +#define CE_ENTRY_CHANGED (1 << 0) +#define CE_ENTRY_REMOVED (1 << 1) +#define CE_ENTRY_ADDED (1 << 2) + struct index_state { struct cache_entry **cache; unsigned int version; diff --git a/read-cache.c b/read-cache.c index 9819363..6971fc4 100644 --- a/read-cache.c +++ b/read-cache.c @@ -51,7 +51,7 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache remove_name_hash(istate, old); free(old); set_index_entry(istate, nr, ce); - istate->cache_changed = 1; + istate->cache_changed |= CE_ENTRY_CHANGED; } void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name) @@ -482,7 +482,7 @@ int remove_index_entry_at(struct index_state *istate, int pos) record_resolve_undo(istate, ce); remove_name_hash(istate, ce); free(ce); - istate->cache_changed = 1; + istate->cache_changed |= CE_ENTRY_REMOVED; istate->cache_nr--; if (pos >= istate->cache_nr) return 0; @@ -512,7 +512,7 @@ void remove_marked_cache_entries(struct index_state *istate) } if (j == istate->cache_nr) return; - istate->cache_changed = 1; + istate->cache_changed |= CE_ENTRY_REMOVED; istate->cache_nr = j; } @@ -1002,7 +1002,7 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti istate->cache + pos, (istate->cache_nr - pos - 1) * sizeof(ce)); set_index_entry(istate, pos, ce); - istate->cache_changed = 1; + istate->cache_changed |= CE_ENTRY_ADDED; return 0; } @@ -1101,6 +1101,7 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate, !(ce->ce_flags & CE_VALID)) updated->ce_flags &= ~CE_VALID; + /* istate->cache_changed is updated in the caller */ return updated; } @@ -1182,7 +1183,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, * means the index is not valid anymore. */ ce->ce_flags &= ~CE_VALID; - istate->cache_changed = 1; + istate->cache_changed |= CE_ENTRY_CHANGED; } if (quiet) continue; -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/32] unpack-trees: be specific what part of the index has changed
Signed-off-by: Nguyễn Thái Ngọc Duy --- unpack-trees.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unpack-trees.c b/unpack-trees.c index 97fc995..a722685 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -246,7 +246,9 @@ static int verify_absent_sparse(const struct cache_entry *ce, enum unpack_trees_error_types, struct unpack_trees_options *o); -static int apply_sparse_checkout(struct cache_entry *ce, struct unpack_trees_options *o) +static int apply_sparse_checkout(struct index_state *istate, +struct cache_entry *ce, +struct unpack_trees_options *o) { int was_skip_worktree = ce_skip_worktree(ce); @@ -254,6 +256,8 @@ static int apply_sparse_checkout(struct cache_entry *ce, struct unpack_trees_opt ce->ce_flags |= CE_SKIP_WORKTREE; else ce->ce_flags &= ~CE_SKIP_WORKTREE; + if (was_skip_worktree != ce_skip_worktree(ce)) + istate->cache_changed |= CE_ENTRY_CHANGED; /* * if (!was_skip_worktree && !ce_skip_worktree()) { @@ -1131,7 +1135,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options ret = -1; } - if (apply_sparse_checkout(ce, o)) { + if (apply_sparse_checkout(&o->result, ce, o)) { if (!o->show_all_errors) goto return_failed; ret = -1; -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/32] cache-tree: mark istate->cache_changed on cache tree invalidation
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/blame.c| 2 +- builtin/update-index.c | 4 ++-- cache-tree.c | 15 +++ cache-tree.h | 2 +- cache.h| 1 + read-cache.c | 6 +++--- unpack-trees.c | 2 +- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index 88cb799..914d919 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2126,7 +2126,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, * right now, but someday we might optimize diff-index --cached * with cache-tree information. */ - cache_tree_invalidate_path(active_cache_tree, path); + cache_tree_invalidate_path(&the_index, path); return commit; } diff --git a/builtin/update-index.c b/builtin/update-index.c index e0e881b..fa3c441 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -55,7 +55,7 @@ static int mark_ce_flags(const char *path, int flag, int mark) active_cache[pos]->ce_flags |= flag; else active_cache[pos]->ce_flags &= ~flag; - cache_tree_invalidate_path(active_cache_tree, path); + cache_tree_invalidate_path(&the_index, path); active_cache_changed |= CE_ENTRY_CHANGED; return 0; } @@ -267,7 +267,7 @@ static void chmod_path(int flip, const char *path) default: goto fail; } - cache_tree_invalidate_path(active_cache_tree, path); + cache_tree_invalidate_path(&the_index, path); active_cache_changed |= CE_ENTRY_CHANGED; report("chmod %cx '%s'", flip, path); return; diff --git a/cache-tree.c b/cache-tree.c index 52f8692..23ddc73 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -98,7 +98,7 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *it, const char *path) return find_subtree(it, path, pathlen, 1); } -void cache_tree_invalidate_path(struct cache_tree *it, const char *path) +static int do_invalidate_path(struct cache_tree *it, const char *path) { /* a/b/c * ==> invalidate self @@ -116,7 +116,7 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path) #endif if (!it) - return; + return 0; slash = strchrnul(path, '/'); namelen = slash - path; it->entry_count = -1; @@ -137,11 +137,18 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path) (it->subtree_nr - pos - 1)); it->subtree_nr--; } - return; + return 1; } down = find_subtree(it, path, namelen, 0); if (down) - cache_tree_invalidate_path(down->cache_tree, slash + 1); + do_invalidate_path(down->cache_tree, slash + 1); + return 1; +} + +void cache_tree_invalidate_path(struct index_state *istate, const char *path) +{ + if (do_invalidate_path(istate->cache_tree, path)) + istate->cache_changed |= CACHE_TREE_CHANGED; } static int verify_cache(const struct cache_entry * const *cache, diff --git a/cache-tree.h b/cache-tree.h index f1923ad..dfbcfab 100644 --- a/cache-tree.h +++ b/cache-tree.h @@ -23,7 +23,7 @@ struct cache_tree { struct cache_tree *cache_tree(void); void cache_tree_free(struct cache_tree **); -void cache_tree_invalidate_path(struct cache_tree *, const char *); +void cache_tree_invalidate_path(struct index_state *, const char *); struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *); void cache_tree_write(struct strbuf *, struct cache_tree *root); diff --git a/cache.h b/cache.h index 7155052..4c288e8 100644 --- a/cache.h +++ b/cache.h @@ -273,6 +273,7 @@ static inline unsigned int canon_mode(unsigned int mode) #define CE_ENTRY_ADDED (1 << 2) #define SOMETHING_CHANGED (1 << 3) /* unclassified changes go here */ #define RESOLVE_UNDO_CHANGED (1 << 4) +#define CACHE_TREE_CHANGED (1 << 5) struct index_state { struct cache_entry **cache; diff --git a/read-cache.c b/read-cache.c index 6971fc4..f1265d4 100644 --- a/read-cache.c +++ b/read-cache.c @@ -65,7 +65,7 @@ void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n new->ce_namelen = namelen; memcpy(new->name, new_name, namelen + 1); - cache_tree_invalidate_path(istate->cache_tree, old->name); + cache_tree_invalidate_path(istate, old->name); remove_index_entry_at(istate, nr); add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE); } @@ -521,7 +521,7 @@ int remove_file_from_index(struct index_state *istate, const char *path) int pos = index_name_pos(istate, path, strlen(path)); if (pos < 0) pos = -pos-1; - cache_tree_inval
[PATCH 09/32] update-index: be specific what part of the index has changed
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/update-index.c | 6 +++--- cache.h| 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/update-index.c b/builtin/update-index.c index 42cbe4b..e0e881b 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -56,7 +56,7 @@ static int mark_ce_flags(const char *path, int flag, int mark) else active_cache[pos]->ce_flags &= ~flag; cache_tree_invalidate_path(active_cache_tree, path); - active_cache_changed = 1; + active_cache_changed |= CE_ENTRY_CHANGED; return 0; } return -1; @@ -268,7 +268,7 @@ static void chmod_path(int flip, const char *path) goto fail; } cache_tree_invalidate_path(active_cache_tree, path); - active_cache_changed = 1; + active_cache_changed |= CE_ENTRY_CHANGED; report("chmod %cx '%s'", flip, path); return; fail: @@ -889,7 +889,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) INDEX_FORMAT_LB, INDEX_FORMAT_UB); if (the_index.version != preferred_index_format) - active_cache_changed = 1; + active_cache_changed |= SOMETHING_CHANGED; the_index.version = preferred_index_format; } diff --git a/cache.h b/cache.h index d692b74..4133797 100644 --- a/cache.h +++ b/cache.h @@ -271,6 +271,7 @@ static inline unsigned int canon_mode(unsigned int mode) #define CE_ENTRY_CHANGED (1 << 0) #define CE_ENTRY_REMOVED (1 << 1) #define CE_ENTRY_ADDED (1 << 2) +#define SOMETHING_CHANGED (1 << 3) /* unclassified changes go here */ struct index_state { struct cache_entry **cache; -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/32] read-cache: be strict about "changed" in remove_marked_cache_entries()
remove_marked_cache_entries() deletes entries marked with CE_REMOVE. But if there is no such entry, do not mark the index as "changed" because that could trigger an index update unnecessarily. Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/read-cache.c b/read-cache.c index 5761b1f..9819363 100644 --- a/read-cache.c +++ b/read-cache.c @@ -510,6 +510,8 @@ void remove_marked_cache_entries(struct index_state *istate) else ce_array[j++] = ce_array[i]; } + if (j == istate->cache_nr) + return; istate->cache_changed = 1; istate->cache_nr = j; } -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/32] read-cache: store in-memory flags in the first 12 bits of ce_flags
We're running out of room for in-memory flags. But since b60e188 (Strip namelen out of ce_flags into a ce_namelen field - 2012-07-11), we copy the namelen (first 12 bits) to ce_namelen field. So those bits are free to use. Just make sure we do not accidentally write any in-memory flags back. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 2 +- read-cache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index e44048c..57ad318 100644 --- a/cache.h +++ b/cache.h @@ -145,7 +145,7 @@ struct cache_entry { #define CE_STAGESHIFT 12 /* - * Range 0x in ce_flags is divided into + * Range 0x0FFF in ce_flags is divided into * two parts: in-memory flags and on-disk ones. * Flags in CE_EXTENDED_FLAGS will get saved on-disk * if you want to save a new flag, add it in diff --git a/read-cache.c b/read-cache.c index 576e506..5761b1f 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1702,7 +1702,7 @@ static char *copy_cache_entry_to_ondisk(struct ondisk_cache_entry *ondisk, ondisk->size = htonl(ce->ce_stat_data.sd_size); hashcpy(ondisk->sha1, ce->sha1); - flags = ce->ce_flags; + flags = ce->ce_flags & ~CE_NAMEMASK; flags |= (ce_namelen(ce) >= CE_NAMEMASK ? CE_NAMEMASK : ce_namelen(ce)); ondisk->flags = htons(flags); if (ce->ce_flags & CE_EXTENDED) { -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/32] cache-tree: mark istate->cache_changed on cache tree update
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache-tree.c | 25 +++-- cache-tree.h | 2 +- merge-recursive.c | 4 +--- sequencer.c| 4 +--- test-dump-cache-tree.c | 7 --- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/cache-tree.c b/cache-tree.c index 23ddc73..18055f1 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -151,7 +151,7 @@ void cache_tree_invalidate_path(struct index_state *istate, const char *path) istate->cache_changed |= CACHE_TREE_CHANGED; } -static int verify_cache(const struct cache_entry * const *cache, +static int verify_cache(struct cache_entry **cache, int entries, int flags) { int i, funny; @@ -236,7 +236,7 @@ int cache_tree_fully_valid(struct cache_tree *it) } static int update_one(struct cache_tree *it, - const struct cache_entry * const *cache, + struct cache_entry **cache, int entries, const char *base, int baselen, @@ -398,18 +398,19 @@ static int update_one(struct cache_tree *it, return i; } -int cache_tree_update(struct cache_tree *it, - const struct cache_entry * const *cache, - int entries, - int flags) +int cache_tree_update(struct index_state *istate, int flags) { - int i, skip; - i = verify_cache(cache, entries, flags); + struct cache_tree *it = istate->cache_tree; + struct cache_entry **cache = istate->cache; + int entries = istate->cache_nr; + int skip, i = verify_cache(cache, entries, flags); + if (i) return i; i = update_one(it, cache, entries, "", 0, &skip, flags); if (i < 0) return i; + istate->cache_changed |= CACHE_TREE_CHANGED; return 0; } @@ -597,9 +598,7 @@ int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix) was_valid = cache_tree_fully_valid(active_cache_tree); if (!was_valid) { - if (cache_tree_update(active_cache_tree, - (const struct cache_entry * const *)active_cache, - active_nr, flags) < 0) + if (cache_tree_update(&the_index, flags) < 0) return WRITE_TREE_UNMERGED_INDEX; if (0 <= newfd) { if (!write_locked_index(&the_index, lock_file, COMMIT_LOCK)) @@ -698,7 +697,5 @@ int update_main_cache_tree(int flags) { if (!the_index.cache_tree) the_index.cache_tree = cache_tree(); - return cache_tree_update(the_index.cache_tree, -(const struct cache_entry * const *)the_index.cache, -the_index.cache_nr, flags); + return cache_tree_update(&the_index, flags); } diff --git a/cache-tree.h b/cache-tree.h index dfbcfab..154b357 100644 --- a/cache-tree.h +++ b/cache-tree.h @@ -30,7 +30,7 @@ void cache_tree_write(struct strbuf *, struct cache_tree *root); struct cache_tree *cache_tree_read(const char *buffer, unsigned long size); int cache_tree_fully_valid(struct cache_tree *); -int cache_tree_update(struct cache_tree *, const struct cache_entry * const *, int, int); +int cache_tree_update(struct index_state *, int); int update_main_cache_tree(int); diff --git a/merge-recursive.c b/merge-recursive.c index 442c1ec..0b5d34d 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -265,9 +265,7 @@ struct tree *write_tree_from_memory(struct merge_options *o) active_cache_tree = cache_tree(); if (!cache_tree_fully_valid(active_cache_tree) && - cache_tree_update(active_cache_tree, - (const struct cache_entry * const *)active_cache, - active_nr, 0) < 0) + cache_tree_update(&the_index, 0) < 0) die(_("error building trees")); result = lookup_tree(active_cache_tree->sha1); diff --git a/sequencer.c b/sequencer.c index 4fb0774..377c877 100644 --- a/sequencer.c +++ b/sequencer.c @@ -371,9 +371,7 @@ static int is_index_unchanged(void) active_cache_tree = cache_tree(); if (!cache_tree_fully_valid(active_cache_tree)) - if (cache_tree_update(active_cache_tree, - (const struct cache_entry * const *)active_cache, - active_nr, 0)) + if (cache_tree_update(&the_index, 0)) return error(_("Unable to update cache tree\n")); return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.sha1); diff --git a/test-dump-cache-tree.c b/test-dump-cache-tree.c index 47eab97..330ba4f 100644 --- a/test-dump-cache-tree.c +++ b/test-dump-cache-tree.c @@ -56,11 +56,12 @@ static int dump_cach
[PATCH 17/32] read-cache: split-index mode
This split-index mode is designed to keep write cost proportional to the number of changes the user has made, not the size of the work tree. (Read cost is another matter, to be dealt separately.) This mode stores index info in a pair of $GIT_DIR/index and $GIT_DIR/sharedindex.. sharedindex is large and unchanged over time while "index" is smaller and updated often. Format details are in index-format.txt, although not everything is implemented in this patch. Shared indexes are not automatically removed, because it's unclear if the shared index is needed by any (even temporary) indexes by just looking at it. After a while you'll collect stale shared indexes. The good news is one shared index is useable for long, until $GIT_DIR/index becomes too big and sluggish that the new shared index must be created. The safest way to clean shared indexes is to turn off split index mode, so shared files are all garbage, delete them all, then turn on split index mode again. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/gitrepository-layout.txt | 4 ++ Documentation/technical/index-format.txt | 35 Makefile | 1 + cache.h | 3 + read-cache.c | 96 ++-- split-index.c (new) | 90 ++ split-index.h (new) | 25 + unpack-trees.c | 4 ++ 8 files changed, 253 insertions(+), 5 deletions(-) create mode 100644 split-index.c create mode 100644 split-index.h diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt index 17d2ea6..79653f3 100644 --- a/Documentation/gitrepository-layout.txt +++ b/Documentation/gitrepository-layout.txt @@ -155,6 +155,10 @@ index:: The current index file for the repository. It is usually not found in a bare repository. +sharedindex.:: + The shared index part, to be referenced by $GIT_DIR/index and + other temporary index files. Only valid in split index mode. + info:: Additional information about the repository is recorded in this directory. diff --git a/Documentation/technical/index-format.txt b/Documentation/technical/index-format.txt index f352a9b..fe6f316 100644 --- a/Documentation/technical/index-format.txt +++ b/Documentation/technical/index-format.txt @@ -129,6 +129,9 @@ Git index format (Version 4) In version 4, the padding after the pathname does not exist. + Interpretation of index entries in split index mode is completely + different. See below for details. + == Extensions === Cached tree @@ -198,3 +201,35 @@ Git index format - At most three 160-bit object names of the entry in stages from 1 to 3 (nothing is written for a missing stage). +=== Split index + + In split index mode, the majority of index entries could be stored + in a separate file. This extension records the changes to be made on + top of that to produce the final index. + + The signature for this extension is { 'l', 'i, 'n', 'k' }. + + The extension consists of: + + - 160-bit SHA-1 of the shared index file. The shared index file path +is $GIT_DIR/sharedindex.. If all 160 bits are zero, the +index does not require a shared index file. + + - An ewah-encoded delete bitmap, each bit represents an entry in the +shared index. If a bit is set, its corresponding entry in the +shared index will be removed from the final index. Note, because +a delete operation changes index entry positions, but we do need +original positions in replace phase, it's best to just mark +entries for removal, then do a mass deletion after replacement. + + - An ewah-encoded replace bitmap, each bit represents an entry in +the shared index. If a bit is set, its corresponding entry in the +shared index will be replaced with an entry in this index +file. All replaced entries are stored in sorted order in this +index. The first "1" bit in the replace bitmap corresponds to the +first index entry, the second "1" bit to the second entry and so +on. Replaced entries may have empty path names to save space. + + The remaining index entries after replaced ones will be added to the + final index. These added entries are also sorted by entry namme then + stage. diff --git a/Makefile b/Makefile index 74a929b..c3957bb 100644 --- a/Makefile +++ b/Makefile @@ -884,6 +884,7 @@ LIB_OBJS += sha1_name.o LIB_OBJS += shallow.o LIB_OBJS += sideband.o LIB_OBJS += sigchain.o +LIB_OBJS += split-index.o LIB_OBJS += strbuf.o LIB_OBJS += streaming.o LIB_OBJS += string-list.o diff --git a/cache.h b/cache.h index 0f6247c..90a5998 100644 --- a/cache.h +++ b/cache.h @@ -135,6 +135,7 @@ struct cache_entry { unsigned int ce_mode; unsigned int ce_flags; unsigned int ce_namelen; + unsigned int index; /* for link extension */ uns
[PATCH 22/32] split-index: the reading part
CE_REMOVE'd entries are removed here because only parts of the code base (unpack_trees in fact) test this bit when they look for the presence of an entry. Leaving them may confuse the code ignores this bit and expects to see a real entry. Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 2 -- split-index.c | 84 +-- split-index.h | 2 ++ 3 files changed, 84 insertions(+), 4 deletions(-) diff --git a/read-cache.c b/read-cache.c index a717171..a5517bf 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1569,8 +1569,6 @@ int read_index_from(struct index_state *istate, const char *path) if (is_null_sha1(split_index->base_sha1)) return ret; - if (istate->cache_nr) - die("index in split-index mode must contain no entries"); if (split_index->base) discard_index(split_index->base); diff --git a/split-index.c b/split-index.c index 5708807..b03a250 100644 --- a/split-index.c +++ b/split-index.c @@ -16,13 +16,27 @@ int read_link_extension(struct index_state *istate, { const unsigned char *data = data_; struct split_index *si; + int ret; + if (sz < 20) return error("corrupt link extension (too short)"); si = init_split_index(istate); hashcpy(si->base_sha1, data); data += 20; sz -= 20; - if (sz) + if (!sz) + return 0; + si->delete_bitmap = ewah_new(); + ret = ewah_read_mmap(si->delete_bitmap, data, sz); + if (ret < 0) + return error("corrupt delete bitmap in link extension"); + data += ret; + sz -= ret; + si->replace_bitmap = ewah_new(); + ret = ewah_read_mmap(si->replace_bitmap, data, sz); + if (ret < 0) + return error("corrupt replace bitmap in link extension"); + if (ret != sz) return error("garbage at the end of link extension"); return 0; } @@ -60,15 +74,81 @@ static void mark_base_index_entries(struct index_state *base) base->cache[i]->index = i + 1; } +static void mark_entry_for_delete(size_t pos, void *data) +{ + struct index_state *istate = data; + if (pos >= istate->cache_nr) + die("position for delete %d exceeds base index size %d", + (int)pos, istate->cache_nr); + istate->cache[pos]->ce_flags |= CE_REMOVE; + istate->split_index->nr_deletions = 1; +} + +static void replace_entry(size_t pos, void *data) +{ + struct index_state *istate = data; + struct split_index *si = istate->split_index; + struct cache_entry *dst, *src; + if (pos >= istate->cache_nr) + die("position for replacement %d exceeds base index size %d", + (int)pos, istate->cache_nr); + if (si->nr_replacements >= si->saved_cache_nr) + die("too many replacements (%d vs %d)", + si->nr_replacements, si->saved_cache_nr); + dst = istate->cache[pos]; + if (dst->ce_flags & CE_REMOVE) + die("entry %d is marked as both replaced and deleted", + (int)pos); + src = si->saved_cache[si->nr_replacements]; + src->index = pos + 1; + src->ce_flags |= CE_UPDATE_IN_BASE; + free(dst); + dst = src; + si->nr_replacements++; +} + void merge_base_index(struct index_state *istate) { struct split_index *si = istate->split_index; + unsigned int i; mark_base_index_entries(si->base); - istate->cache_nr = si->base->cache_nr; + + si->saved_cache = istate->cache; + si->saved_cache_nr = istate->cache_nr; + istate->cache_nr= si->base->cache_nr; + istate->cache = NULL; + istate->cache_alloc = 0; ALLOC_GROW(istate->cache, istate->cache_nr, istate->cache_alloc); memcpy(istate->cache, si->base->cache, sizeof(*istate->cache) * istate->cache_nr); + + si->nr_deletions = 0; + si->nr_replacements = 0; + ewah_each_bit(si->replace_bitmap, replace_entry, istate); + ewah_each_bit(si->delete_bitmap, mark_entry_for_delete, istate); + if (si->nr_deletions) + remove_marked_cache_entries(istate); + + for (i = si->nr_replacements; i < si->saved_cache_nr; i++) { + add_index_entry(istate, si->saved_cache[i], + ADD_CACHE_OK_TO_ADD | + /* +* we may have to replay what +* merge-recursive.c:update_stages() +* does, which has this flag on +*/ + ADD_CACHE_SKIP_DFCHECK); + si->saved_cache[i] = NULL; + } + + ewah_free(si->delete_bitmap); + ewah_free(si->replace_bitmap); + free(si->saved_cache); +
[PATCH 21/32] split-index: the writing part
prepare_to_write_split_index() does the major work, classifying deleted, updated and added entries. write_link_extension() then just writes it down. An observation is, deleting an entry, then adding it back is recorded as "entry X is deleted, entry X is added", not "entry X is replaced". This is simpler, with small overhead: a replaced entry is stored without its path, a new entry is store with its path. A note about unpack_trees() and the deduplication code inside prepare_to_write_split_index(). Usually tracking updated/removed entries via read-cache API is enough. unpack_trees() manipulates the index in a different way: it throws the entire source index out, builds up a new one, copying/duplicating entries (using dup_entry) from the source index over if necessary, then returns the new index. A naive solution would be marking the entire source index "deleted" and add their duplicates as new. That could bring $GIT_DIR/index back to the original size. So we try harder and memcmp() between the original and the duplicate to see if it needs updating. We could avoid memcmp() too, by avoiding duplicating the original entry in dup_entry(). The performance gain this way is within noise level and it complicates unpack-trees.c. So memcmp() is the preferred way to deal with deduplication. Signed-off-by: Nguyễn Thái Ngọc Duy --- split-index.c | 101 -- split-index.h | 4 +++ 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/split-index.c b/split-index.c index b36c73b..5708807 100644 --- a/split-index.c +++ b/split-index.c @@ -1,5 +1,6 @@ #include "cache.h" #include "split-index.h" +#include "ewah/ewok.h" struct split_index *init_split_index(struct index_state *istate) { @@ -26,11 +27,22 @@ int read_link_extension(struct index_state *istate, return 0; } +static int write_strbuf(void *user_data, const void *data, size_t len) +{ + struct strbuf *sb = user_data; + strbuf_add(sb, data, len); + return len; +} + int write_link_extension(struct strbuf *sb, struct index_state *istate) { struct split_index *si = istate->split_index; strbuf_add(sb, si->base_sha1, 20); + if (!si->delete_bitmap && !si->replace_bitmap) + return 0; + ewah_serialize_to(si->delete_bitmap, write_strbuf, sb); + ewah_serialize_to(si->replace_bitmap, write_strbuf, sb); return 0; } @@ -62,14 +74,99 @@ void merge_base_index(struct index_state *istate) void prepare_to_write_split_index(struct index_state *istate) { struct split_index *si = init_split_index(istate); - /* take cache[] out temporarily */ + struct cache_entry **entries = NULL, *ce; + int i, nr_entries = 0, nr_alloc = 0; + + si->delete_bitmap = ewah_new(); + si->replace_bitmap = ewah_new(); + + if (si->base) { + /* Go through istate->cache[] and mark CE_MATCHED to +* entry with positive index. We'll go through +* base->cache[] later to delete all entries in base +* that are not marked eith either CE_MATCHED or +* CE_UPDATE_IN_BASE. If istate->cache[i] is a +* duplicate, deduplicate it. +*/ + for (i = 0; i < istate->cache_nr; i++) { + struct cache_entry *base; + /* namelen is checked separately */ + const unsigned int ondisk_flags = + CE_STAGEMASK | CE_VALID | CE_EXTENDED_FLAGS; + unsigned int ce_flags, base_flags, ret; + ce = istate->cache[i]; + if (!ce->index) + continue; + if (ce->index > si->base->cache_nr) { + ce->index = 0; + continue; + } + ce->ce_flags |= CE_MATCHED; /* or "shared" */ + base = si->base->cache[ce->index - 1]; + if (ce == base) + continue; + if (ce->ce_namelen != base->ce_namelen || + strcmp(ce->name, base->name)) { + ce->index = 0; + continue; + } + ce_flags = ce->ce_flags; + base_flags = base->ce_flags; + /* only on-disk flags matter */ + ce->ce_flags &= ondisk_flags; + base->ce_flags &= ondisk_flags; + ret = memcmp(&ce->ce_stat_data, &base->ce_stat_data, +offsetof(struct cache_entry, name) - +offsetof(struct cache_entry, ce_stat_data)); + ce->ce_flags = ce_flags; +
[PATCH 14/32] cache-tree: mark istate->cache_changed on prime_cache_tree()
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/read-tree.c | 2 +- builtin/reset.c | 2 +- cache-tree.c| 9 + cache-tree.h| 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/builtin/read-tree.c b/builtin/read-tree.c index f26d90f..3204c62 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -231,7 +231,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) * what came from the tree. */ if (nr_trees == 1 && !opts.prefix) - prime_cache_tree(&active_cache_tree, trees[0]); + prime_cache_tree(&the_index, trees[0]); if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) die("unable to write new index file"); diff --git a/builtin/reset.c b/builtin/reset.c index 0c56d28..234b2eb 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -84,7 +84,7 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet) if (reset_type == MIXED || reset_type == HARD) { tree = parse_tree_indirect(sha1); - prime_cache_tree(&active_cache_tree, tree); + prime_cache_tree(&the_index, tree); } return 0; diff --git a/cache-tree.c b/cache-tree.c index 18055f1..c53f7de 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -654,11 +654,12 @@ static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree) it->entry_count = cnt; } -void prime_cache_tree(struct cache_tree **it, struct tree *tree) +void prime_cache_tree(struct index_state *istate, struct tree *tree) { - cache_tree_free(it); - *it = cache_tree(); - prime_cache_tree_rec(*it, tree); + cache_tree_free(&istate->cache_tree); + istate->cache_tree = cache_tree(); + prime_cache_tree_rec(istate->cache_tree, tree); + istate->cache_changed |= CACHE_TREE_CHANGED; } /* diff --git a/cache-tree.h b/cache-tree.h index 154b357..b47ccec 100644 --- a/cache-tree.h +++ b/cache-tree.h @@ -46,7 +46,7 @@ int update_main_cache_tree(int); #define WRITE_TREE_PREFIX_ERROR (-3) int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix); -void prime_cache_tree(struct cache_tree **, struct tree *); +void prime_cache_tree(struct index_state *, struct tree *); extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info); -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 23/32] split-index: do not invalidate cache-tree at read time
We are sure that after merge_base_index() is done. cache-tree can still be used with the final index. So don't destroy cache tree. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 1 + read-cache.c | 3 ++- split-index.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cache.h b/cache.h index 127804e..be95b84 100644 --- a/cache.h +++ b/cache.h @@ -488,6 +488,7 @@ extern int index_name_pos(const struct index_state *, const char *name, int name #define ADD_CACHE_SKIP_DFCHECK 4 /* Ok to skip DF conflict checks */ #define ADD_CACHE_JUST_APPEND 8/* Append only; tree.c::read_tree() */ #define ADD_CACHE_NEW_ONLY 16 /* Do not replace existing ones */ +#define ADD_CACHE_KEEP_CACHE_TREE 32 /* Do not invalidate cache-tree */ extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option); extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name); extern int remove_index_entry_at(struct index_state *, int pos); diff --git a/read-cache.c b/read-cache.c index a5517bf..43a61d3 100644 --- a/read-cache.c +++ b/read-cache.c @@ -950,7 +950,8 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e int skip_df_check = option & ADD_CACHE_SKIP_DFCHECK; int new_only = option & ADD_CACHE_NEW_ONLY; - cache_tree_invalidate_path(istate, ce->name); + if (!(option & ADD_CACHE_KEEP_CACHE_TREE)) + cache_tree_invalidate_path(istate, ce->name); pos = index_name_stage_pos(istate, ce->name, ce_namelen(ce), ce_stage(ce)); /* existing match? Just replace it. */ diff --git a/split-index.c b/split-index.c index b03a250..33c0c4b 100644 --- a/split-index.c +++ b/split-index.c @@ -133,6 +133,7 @@ void merge_base_index(struct index_state *istate) for (i = si->nr_replacements; i < si->saved_cache_nr; i++) { add_index_entry(istate, si->saved_cache[i], ADD_CACHE_OK_TO_ADD | + ADD_CACHE_KEEP_CACHE_TREE | /* * we may have to replay what * merge-recursive.c:update_stages() -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/32] read-cache: save deleted entries in split index
Entries that belong to the base index should not be freed. Mark CE_REMOVE to track them. Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 14 -- split-index.c | 12 split-index.h | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/read-cache.c b/read-cache.c index 2f2e0c1..7cdb171 100644 --- a/read-cache.c +++ b/read-cache.c @@ -39,7 +39,7 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, /* changes that can be kept in $GIT_DIR/index (basically all extensions) */ #define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \ -CE_ENTRY_ADDED) +CE_ENTRY_ADDED | CE_ENTRY_REMOVED) struct index_state the_index; static const char *alternate_index_output; @@ -488,7 +488,7 @@ int remove_index_entry_at(struct index_state *istate, int pos) record_resolve_undo(istate, ce); remove_name_hash(istate, ce); - free(ce); + save_or_free_index_entry(istate, ce); istate->cache_changed |= CE_ENTRY_REMOVED; istate->cache_nr--; if (pos >= istate->cache_nr) @@ -512,7 +512,7 @@ void remove_marked_cache_entries(struct index_state *istate) for (i = j = 0; i < istate->cache_nr; i++) { if (ce_array[i]->ce_flags & CE_REMOVE) { remove_name_hash(istate, ce_array[i]); - free(ce_array[i]); + save_or_free_index_entry(istate, ce_array[i]); } else ce_array[j++] = ce_array[i]; @@ -577,7 +577,9 @@ static int different_name(struct cache_entry *ce, struct cache_entry *alias) * So we use the CE_ADDED flag to verify that the alias was an old * one before we accept it as */ -static struct cache_entry *create_alias_ce(struct cache_entry *ce, struct cache_entry *alias) +static struct cache_entry *create_alias_ce(struct index_state *istate, + struct cache_entry *ce, + struct cache_entry *alias) { int len; struct cache_entry *new; @@ -590,7 +592,7 @@ static struct cache_entry *create_alias_ce(struct cache_entry *ce, struct cache_ new = xcalloc(1, cache_entry_size(len)); memcpy(new->name, alias->name, len); copy_cache_entry(new, ce); - free(ce); + save_or_free_index_entry(istate, ce); return new; } @@ -683,7 +685,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st, set_object_name_for_intent_to_add_entry(ce); if (ignore_case && alias && different_name(ce, alias)) - ce = create_alias_ce(ce, alias); + ce = create_alias_ce(istate, ce, alias); ce->ce_flags |= CE_ADDED; /* It was suspected to be racily clean, but it turns out to be Ok */ diff --git a/split-index.c b/split-index.c index 63b52bb..2bb5d55 100644 --- a/split-index.c +++ b/split-index.c @@ -88,3 +88,15 @@ void discard_split_index(struct index_state *istate) } free(si); } + +void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce) +{ + if (ce->index && + istate->split_index && + istate->split_index->base && + ce->index <= istate->split_index->base->cache_nr && + ce == istate->split_index->base->cache[ce->index - 1]) + ce->ce_flags |= CE_REMOVE; + else + free(ce); +} diff --git a/split-index.h b/split-index.h index 8d74041..5302118 100644 --- a/split-index.h +++ b/split-index.h @@ -12,6 +12,7 @@ struct split_index { }; struct split_index *init_split_index(struct index_state *istate); +void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce); int read_link_extension(struct index_state *istate, const void *data, unsigned long sz); int write_link_extension(struct strbuf *sb, -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 24/32] split-index: strip pathname of on-disk replaced entries
We know the positions of replaced entries via the replace bitmap in "link" extension, so the "name" path does not have to be stored (it's still in the shared index). With this, we also have a way to distinguish additions vs replacements at load time and can catch broken "link" extensions. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 1 + read-cache.c | 10 ++ split-index.c | 14 -- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index be95b84..604328b 100644 --- a/cache.h +++ b/cache.h @@ -170,6 +170,7 @@ struct cache_entry { #define CE_MATCHED (1 << 26) #define CE_UPDATE_IN_BASE(1 << 27) +#define CE_STRIP_NAME(1 << 28) /* * Extended on-disk flags diff --git a/read-cache.c b/read-cache.c index 43a61d3..81835a6 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1787,9 +1787,15 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce, { int size; struct ondisk_cache_entry *ondisk; + int saved_namelen; char *name; int result; + if (ce->ce_flags & CE_STRIP_NAME) { + saved_namelen = ce_namelen(ce); + ce->ce_namelen = 0; + } + if (!previous_name) { size = ondisk_ce_size(ce); ondisk = xcalloc(1, size); @@ -1821,6 +1827,10 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce, strbuf_splice(previous_name, common, to_remove, ce->name + common, ce_namelen(ce) - common); } + if (ce->ce_flags & CE_STRIP_NAME) { + ce->ce_namelen = saved_namelen; + ce->ce_flags &= ~CE_STRIP_NAME; + } result = ce_write(c, fd, ondisk, size); free(ondisk); diff --git a/split-index.c b/split-index.c index 33c0c4b..ee3246f 100644 --- a/split-index.c +++ b/split-index.c @@ -89,6 +89,7 @@ static void replace_entry(size_t pos, void *data) struct index_state *istate = data; struct split_index *si = istate->split_index; struct cache_entry *dst, *src; + if (pos >= istate->cache_nr) die("position for replacement %d exceeds base index size %d", (int)pos, istate->cache_nr); @@ -100,10 +101,14 @@ static void replace_entry(size_t pos, void *data) die("entry %d is marked as both replaced and deleted", (int)pos); src = si->saved_cache[si->nr_replacements]; + if (ce_namelen(src)) + die("corrupt link extension, entry %d should have " + "zero length name", (int)pos); src->index = pos + 1; src->ce_flags |= CE_UPDATE_IN_BASE; - free(dst); - dst = src; + src->ce_namelen = dst->ce_namelen; + copy_cache_entry(dst, src); + free(src); si->nr_replacements++; } @@ -131,6 +136,9 @@ void merge_base_index(struct index_state *istate) remove_marked_cache_entries(istate); for (i = si->nr_replacements; i < si->saved_cache_nr; i++) { + if (!ce_namelen(si->saved_cache[i])) + die("corrupt link extension, entry %d should " + "have non-zero length name", i); add_index_entry(istate, si->saved_cache[i], ADD_CACHE_OK_TO_ADD | ADD_CACHE_KEEP_CACHE_TREE | @@ -213,6 +221,7 @@ void prepare_to_write_split_index(struct index_state *istate) ewah_set(si->delete_bitmap, i); else if (ce->ce_flags & CE_UPDATE_IN_BASE) { ewah_set(si->replace_bitmap, i); + ce->ce_flags |= CE_STRIP_NAME; ALLOC_GROW(entries, nr_entries+1, nr_alloc); entries[nr_entries++] = ce; } @@ -222,6 +231,7 @@ void prepare_to_write_split_index(struct index_state *istate) for (i = 0; i < istate->cache_nr; i++) { ce = istate->cache[i]; if ((!si->base || !ce->index) && !(ce->ce_flags & CE_REMOVE)) { + assert(!(ce->ce_flags & CE_STRIP_NAME)); ALLOC_GROW(entries, nr_entries+1, nr_alloc); entries[nr_entries++] = ce; } -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 20/32] read-cache: mark updated entries for split index
The large part of this patch just follows CE_ENTRY_CHANGED marks. replace_index_entry() is updated to update split_index->base->cache[] as well so base->cache[] does not reference to a freed entry. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/update-index.c | 2 ++ cache.h| 2 ++ entry.c| 1 + read-cache.c | 5 - split-index.c | 15 +++ split-index.h | 3 +++ unpack-trees.c | 4 +++- 7 files changed, 30 insertions(+), 2 deletions(-) diff --git a/builtin/update-index.c b/builtin/update-index.c index fa3c441..f7a19c4 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -55,6 +55,7 @@ static int mark_ce_flags(const char *path, int flag, int mark) active_cache[pos]->ce_flags |= flag; else active_cache[pos]->ce_flags &= ~flag; + active_cache[pos]->ce_flags |= CE_UPDATE_IN_BASE; cache_tree_invalidate_path(&the_index, path); active_cache_changed |= CE_ENTRY_CHANGED; return 0; @@ -268,6 +269,7 @@ static void chmod_path(int flip, const char *path) goto fail; } cache_tree_invalidate_path(&the_index, path); + ce->ce_flags |= CE_UPDATE_IN_BASE; active_cache_changed |= CE_ENTRY_CHANGED; report("chmod %cx '%s'", flip, path); return; diff --git a/cache.h b/cache.h index 90a5998..127804e 100644 --- a/cache.h +++ b/cache.h @@ -169,6 +169,8 @@ struct cache_entry { /* used to temporarily mark paths matched by pathspecs */ #define CE_MATCHED (1 << 26) +#define CE_UPDATE_IN_BASE(1 << 27) + /* * Extended on-disk flags */ diff --git a/entry.c b/entry.c index d913c1d..1eda8e9 100644 --- a/entry.c +++ b/entry.c @@ -214,6 +214,7 @@ finish: if (!fstat_done) lstat(ce->name, &st); fill_stat_cache_info(ce, &st); + ce->ce_flags |= CE_UPDATE_IN_BASE; state->istate->cache_changed |= CE_ENTRY_CHANGED; } return 0; diff --git a/read-cache.c b/read-cache.c index 7cdb171..a717171 100644 --- a/read-cache.c +++ b/read-cache.c @@ -39,7 +39,7 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, /* changes that can be kept in $GIT_DIR/index (basically all extensions) */ #define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \ -CE_ENTRY_ADDED | CE_ENTRY_REMOVED) +CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED) struct index_state the_index; static const char *alternate_index_output; @@ -54,9 +54,11 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache { struct cache_entry *old = istate->cache[nr]; + replace_index_entry_in_base(istate, old, ce); remove_name_hash(istate, old); free(old); set_index_entry(istate, nr, ce); + ce->ce_flags |= CE_UPDATE_IN_BASE; istate->cache_changed |= CE_ENTRY_CHANGED; } @@ -1192,6 +1194,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, * means the index is not valid anymore. */ ce->ce_flags &= ~CE_VALID; + ce->ce_flags |= CE_UPDATE_IN_BASE; istate->cache_changed |= CE_ENTRY_CHANGED; } if (quiet) diff --git a/split-index.c b/split-index.c index 2bb5d55..b36c73b 100644 --- a/split-index.c +++ b/split-index.c @@ -100,3 +100,18 @@ void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce else free(ce); } + +void replace_index_entry_in_base(struct index_state *istate, +struct cache_entry *old, +struct cache_entry *new) +{ + if (old->index && + istate->split_index && + istate->split_index->base && + old->index <= istate->split_index->base->cache_nr) { + new->index = old->index; + if (old != istate->split_index->base->cache[new->index - 1]) + free(istate->split_index->base->cache[new->index - 1]); + istate->split_index->base->cache[new->index - 1] = new; + } +} diff --git a/split-index.h b/split-index.h index 5302118..812e510 100644 --- a/split-index.h +++ b/split-index.h @@ -13,6 +13,9 @@ struct split_index { struct split_index *init_split_index(struct index_state *istate); void save_or_free_index_entry(struct index_state *istate, struct cache_entry *ce); +void replace_index_entry_in_base(struct index_state *istate, +struct cache_entry *old, +struct cache_entry *new); int read_link_extension(struct index_state *istate,
[PATCH 31/32] t2104: make sure split index mode is off for the version test
Version tests only make sense when all entries are in the same file, so we can see if version is downgraded to 2 if 3 is not required. Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t2104-update-index-skip-worktree.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/t2104-update-index-skip-worktree.sh b/t/t2104-update-index-skip-worktree.sh index 29c1fb1..cc830da 100755 --- a/t/t2104-update-index-skip-worktree.sh +++ b/t/t2104-update-index-skip-worktree.sh @@ -7,6 +7,8 @@ test_description='skip-worktree bit test' . ./test-lib.sh +sane_unset GIT_TEST_SPLIT_INDEX + test_set_index_version 3 cat >expect.full
[PATCH 29/32] read-tree: note about dropping split-index mode or index version
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/read-tree.c | 9 + 1 file changed, 9 insertions(+) diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 3204c62..e7e1c33 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -155,6 +155,15 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) if (1 < opts.merge + opts.reset + prefix_set) die("Which one? -m, --reset, or --prefix?"); + /* +* NEEDSWORK +* +* The old index should be read anyway even if we're going to +* destroy all index entries because we still need to preserve +* certain information such as index version or split-index +* mode. +*/ + if (opts.reset || opts.merge || opts.prefix) { if (read_cache_unmerged() && (opts.prefix || opts.merge)) die("You need to resolve your current index first"); -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 32/32] t1700: new tests for split-index mode
Signed-off-by: Nguyễn Thái Ngọc Duy --- .gitignore | 1 + Makefile| 1 + cache.h | 2 + read-cache.c| 3 +- t/t1700-split-index.sh (new +x) | 194 test-dump-split-index.c (new) | 34 +++ 6 files changed, 233 insertions(+), 2 deletions(-) create mode 100755 t/t1700-split-index.sh create mode 100644 test-dump-split-index.c diff --git a/.gitignore b/.gitignore index dc600f9..70992a4 100644 --- a/.gitignore +++ b/.gitignore @@ -180,6 +180,7 @@ /test-date /test-delta /test-dump-cache-tree +/test-dump-split-index /test-scrap-cache-tree /test-genrandom /test-hashmap diff --git a/Makefile b/Makefile index c3957bb..e39a4f5 100644 --- a/Makefile +++ b/Makefile @@ -562,6 +562,7 @@ TEST_PROGRAMS_NEED_X += test-ctype TEST_PROGRAMS_NEED_X += test-date TEST_PROGRAMS_NEED_X += test-delta TEST_PROGRAMS_NEED_X += test-dump-cache-tree +TEST_PROGRAMS_NEED_X += test-dump-split-index TEST_PROGRAMS_NEED_X += test-genrandom TEST_PROGRAMS_NEED_X += test-hashmap TEST_PROGRAMS_NEED_X += test-index-version diff --git a/cache.h b/cache.h index 42cdfe6..6ad2595 100644 --- a/cache.h +++ b/cache.h @@ -473,6 +473,8 @@ extern int daemonize(void); struct lock_file; extern int read_index(struct index_state *); extern int read_index_preload(struct index_state *, const struct pathspec *pathspec); +extern int do_read_index(struct index_state *istate, const char *path, +int must_exist); /* for testting only! */ extern int read_index_from(struct index_state *, const char *path); extern int is_index_unborn(struct index_state *); extern int read_index_unmerged(struct index_state *); diff --git a/read-cache.c b/read-cache.c index 831b67e..159c3e8 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1463,8 +1463,7 @@ static struct cache_entry *create_from_disk(struct ondisk_cache_entry *ondisk, } /* remember to discard_cache() before reading a different cache! */ -static int do_read_index(struct index_state *istate, const char *path, -int must_exist) +int do_read_index(struct index_state *istate, const char *path, int must_exist) { int fd, i; struct stat st; diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh new file mode 100755 index 000..94fb473 --- /dev/null +++ b/t/t1700-split-index.sh @@ -0,0 +1,194 @@ +#!/bin/sh + +test_description='split index mode tests' + +. ./test-lib.sh + +# We need total control of index splitting here +sane_unset GIT_TEST_SPLIT_INDEX + +test_expect_success 'enable split index' ' + git update-index --split-index && + test-dump-split-index .git/index >actual && + cat >expectls-files.actual && + cat >ls-files.expect expect ls-files.expect expect ls-files.expect expect ls-files.actual && + cat >ls-files.expect expect ls-files.actual && + cat >ls-files.expect expect ls-files.expect expect ls-files.expect expect ls-files.actual && + cat >ls-files.expect expect actual && + cat >expect ls-files.expect expect ce_mode, + sha1_to_hex(ce->sha1), ce_stage(ce), ce->name); + } + printf("replacements:"); + ewah_each_bit(si->replace_bitmap, show_bit, NULL); + printf("\ndeletions:"); + ewah_each_bit(si->delete_bitmap, show_bit, NULL); + printf("\n"); + return 0; +} -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 16/32] read-cache: save index SHA-1 after reading
Also update SHA-1 after writing. If we do not do that, the second read_index() will see "initialized" variable already set and not read .git/index again, which is fine, except istate->sha1 now has a stale value. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h| 1 + read-cache.c | 6 -- unpack-trees.c | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index 9bbebab..0f6247c 100644 --- a/cache.h +++ b/cache.h @@ -286,6 +286,7 @@ struct index_state { initialized : 1; struct hashmap name_hash; struct hashmap dir_hash; + unsigned char sha1[20]; }; extern struct index_state the_index; diff --git a/read-cache.c b/read-cache.c index f1265d4..723d769 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1481,6 +1481,7 @@ int read_index_from(struct index_state *istate, const char *path) if (verify_hdr(hdr, mmap_size) < 0) goto unmap; + hashcpy(istate->sha1, (const unsigned char *)hdr + mmap_size - 20); istate->version = ntohl(hdr->hdr_version); istate->cache_nr = ntohl(hdr->hdr_entries); istate->cache_alloc = alloc_nr(istate->cache_nr); @@ -1616,7 +1617,7 @@ static int write_index_ext_header(git_SHA_CTX *context, int fd, (ce_write(context, fd, &sz, 4) < 0)) ? -1 : 0; } -static int ce_flush(git_SHA_CTX *context, int fd) +static int ce_flush(git_SHA_CTX *context, int fd, unsigned char *sha1) { unsigned int left = write_buffer_len; @@ -1634,6 +1635,7 @@ static int ce_flush(git_SHA_CTX *context, int fd) /* Append the SHA1 signature at the end */ git_SHA1_Final(write_buffer + left, context); + hashcpy(sha1, write_buffer + left); left += 20; return (write_in_full(fd, write_buffer, left) != left) ? -1 : 0; } @@ -1872,7 +1874,7 @@ static int do_write_index(struct index_state *istate, int newfd) return -1; } - if (ce_flush(&c, newfd) || fstat(newfd, &st)) + if (ce_flush(&c, newfd, istate->sha1) || fstat(newfd, &st)) return -1; istate->timestamp.sec = (unsigned int)st.st_mtime; istate->timestamp.nsec = ST_MTIME_NSEC(st); diff --git a/unpack-trees.c b/unpack-trees.c index 26f65c7..f594932 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1046,6 +1046,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options o->result.timestamp.sec = o->src_index->timestamp.sec; o->result.timestamp.nsec = o->src_index->timestamp.nsec; o->result.version = o->src_index->version; + hashcpy(o->result.sha1, o->src_index->sha1); o->merge_size = len; mark_all_ce_unused(o->src_index); -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 30/32] read-cache: force split index mode with GIT_TEST_SPLIT_INDEX
This could be used to run the whole test suite with split indexes. Index splitting is carried out at random. "git read-tree" also resets the index and forces splitting at the next update. I had a lot of headaches with the test suite, which proves it exercises split index pretty good. Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/read-cache.c b/read-cache.c index 568bc20..831b67e 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1885,8 +1885,11 @@ static int do_write_index(struct index_state *istate, int newfd, } } - if (!istate->version) + if (!istate->version) { istate->version = get_index_format_default(); + if (getenv("GIT_TEST_SPLIT_INDEX")) + init_split_index(istate); + } /* demote version 3 to version 2 when the latter suffices */ if (istate->version == 3 || istate->version == 2) @@ -2077,6 +2080,11 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock, return do_write_locked_index(istate, lock, flags); } + if (getenv("GIT_TEST_SPLIT_INDEX")) { + int v = si->base_sha1[0]; + if ((v & 15) < 6) + istate->cache_changed |= SPLIT_INDEX_ORDERED; + } if (istate->cache_changed & SPLIT_INDEX_ORDERED) { int ret = write_shared_index(istate, lock, flags); if (ret) -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 25/32] update-index: new options to enable/disable split index mode
If you have a large work tree but only make changes in a subset, then $GIT_DIR/index's size should be stable after a while. If you change branches that touch something else, $GIT_DIR/index's size may grow large that it becomes as slow as the unified index. Do --split-index again occasionally to force all changes back to the shared index and keep $GIT_DIR/index small. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-update-index.txt | 11 +++ builtin/update-index.c | 18 ++ cache.h| 1 + read-cache.c | 67 ++ split-index.c | 23 + 5 files changed, 114 insertions(+), 6 deletions(-) diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt index d6de4a0..dfc09d9 100644 --- a/Documentation/git-update-index.txt +++ b/Documentation/git-update-index.txt @@ -161,6 +161,17 @@ may not support it yet. Only meaningful with `--stdin` or `--index-info`; paths are separated with NUL character instead of LF. +--split-index:: +--no-split-index:: + Enable or disable split index mode. If enabled, the index is + split into two files, $GIT_DIR/index and $GIT_DIR/sharedindex.. + Changes are accumulated in $GIT_DIR/index while the shared + index file contains all index entries stays unchanged. If + split-index mode is already enabled and `--split-index` is + given again, all changes in $GIT_DIR/index are pushed back to + the shared index file. This mode is designed for very large + indexes that take a signficant amount of time to read or write. + \--:: Do not interpret any more arguments as options. diff --git a/builtin/update-index.c b/builtin/update-index.c index f7a19c4..b0503f4 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -13,6 +13,7 @@ #include "parse-options.h" #include "pathspec.h" #include "dir.h" +#include "split-index.h" /* * Default to not allowing changes to the list of files. The @@ -742,6 +743,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) char set_executable_bit = 0; struct refresh_params refresh_args = {0, &has_errors}; int lock_error = 0; + int split_index = -1; struct lock_file *lock_file; struct parse_opt_ctx_t ctx; int parseopt_state = PARSE_OPT_UNKNOWN; @@ -824,6 +826,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) resolve_undo_clear_callback}, OPT_INTEGER(0, "index-version", &preferred_index_format, N_("write index in this format")), + OPT_BOOL(0, "split-index", &split_index, + N_("enable or disable split index")), OPT_END() }; @@ -917,6 +921,20 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) strbuf_release(&buf); } + if (split_index > 0) { + init_split_index(&the_index); + the_index.cache_changed |= SPLIT_INDEX_ORDERED; + } else if (!split_index && the_index.split_index) { + /* +* can't discard_split_index(&the_index); because that +* will destroy split_index->base->cache[], which may +* be shared with the_index.cache[]. So yeah we're +* leaking a bit here. +*/ + the_index.split_index = NULL; + the_index.cache_changed |= SOMETHING_CHANGED; + } + if (active_cache_changed) { if (newfd < 0) { if (refresh_args.flags & REFRESH_QUIET) diff --git a/cache.h b/cache.h index 604328b..42cdfe6 100644 --- a/cache.h +++ b/cache.h @@ -278,6 +278,7 @@ static inline unsigned int canon_mode(unsigned int mode) #define SOMETHING_CHANGED (1 << 3) /* unclassified changes go here */ #define RESOLVE_UNDO_CHANGED (1 << 4) #define CACHE_TREE_CHANGED (1 << 5) +#define SPLIT_INDEX_ORDERED(1 << 6) struct split_index; struct index_state { diff --git a/read-cache.c b/read-cache.c index 81835a6..a6c9407 100644 --- a/read-cache.c +++ b/read-cache.c @@ -15,6 +15,7 @@ #include "strbuf.h" #include "varint.h" #include "split-index.h" +#include "sigchain.h" static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, unsigned int options); @@ -39,7 +40,8 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, /* changes that can be kept in $GIT_DIR/index (basically all extensions) */ #define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \ -CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED) +CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED | \ +SPLIT_INDEX_ORDERED) struct index_state the_inde
[PATCH 28/32] read-tree: force split-index mode off on --index-output
Just a (paranoid?) safety measure.. Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/read-cache.c b/read-cache.c index f9fc3a5..568bc20 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2070,7 +2070,8 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock, { struct split_index *si = istate->split_index; - if (!si || (istate->cache_changed & ~EXTMASK)) { + if (!si || alternate_index_output || + (istate->cache_changed & ~EXTMASK)) { if (si) hashclr(si->base_sha1); return do_write_locked_index(istate, lock, flags); -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/32] read-cache: mark new entries for split index
Make sure entry addition does not lead to unifying the index. We don't need to explicitly keep track of new entries. If ce->index is zero, they're new. Otherwise it's unlikely that they are new, but we'll do a through check later at writing time. Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/read-cache.c b/read-cache.c index ff889ad..2f2e0c1 100644 --- a/read-cache.c +++ b/read-cache.c @@ -38,7 +38,8 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, #define CACHE_EXT_LINK 0x6c696e6b/* "link" */ /* changes that can be kept in $GIT_DIR/index (basically all extensions) */ -#define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED) +#define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \ +CE_ENTRY_ADDED) struct index_state the_index; static const char *alternate_index_output; -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 26/32] update-index --split-index: do not split if $GIT_DIR is read only
If $GIT_DIR is read only, we can't write $GIT_DIR/sharedindex. This could happen when $GIT_INDEX_FILE is set to somehwere outside $GIT_DIR. Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/read-cache.c b/read-cache.c index a6c9407..f9fc3a5 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2030,14 +2030,21 @@ static void remove_temporary_sharedindex_on_signal(int signo) raise(signo); } -static int write_shared_index(struct index_state *istate) +static int write_shared_index(struct index_state *istate, + struct lock_file *lock, unsigned flags) { struct split_index *si = istate->split_index; static int installed_handler; int fd, ret; temporary_sharedindex = git_pathdup("sharedindex_XX"); - fd = xmkstemp(temporary_sharedindex); + fd = mkstemp(temporary_sharedindex); + if (fd < 0) { + free(temporary_sharedindex); + temporary_sharedindex = NULL; + hashclr(si->base_sha1); + return do_write_locked_index(istate, lock, flags); + } if (!installed_handler) { atexit(remove_temporary_sharedindex); sigchain_push_common(remove_temporary_sharedindex_on_signal); @@ -2070,7 +2077,7 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock, } if (istate->cache_changed & SPLIT_INDEX_ORDERED) { - int ret = write_shared_index(istate); + int ret = write_shared_index(istate, lock, flags); if (ret) return ret; } -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 15/32] entry.c: update cache_changed if refresh_cache is set in checkout_entry()
Other fill_stat_cache_info() is on new entries, which should set CE_ENTRY_ADDED in cache_changed, so we're safe. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/apply.c | 8 +--- builtin/checkout-index.c | 1 + builtin/checkout.c | 1 + cache.h | 1 + entry.c | 2 ++ unpack-trees.c | 1 + 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 5e13444..adca035 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3084,13 +3084,15 @@ static void prepare_fn_table(struct patch *patch) } } -static int checkout_target(struct cache_entry *ce, struct stat *st) +static int checkout_target(struct index_state *istate, + struct cache_entry *ce, struct stat *st) { struct checkout costate; memset(&costate, 0, sizeof(costate)); costate.base_dir = ""; costate.refresh_cache = 1; + costate.istate = istate; if (checkout_entry(ce, &costate, NULL) || lstat(ce->name, st)) return error(_("cannot checkout %s"), ce->name); return 0; @@ -3257,7 +3259,7 @@ static int load_current(struct image *image, struct patch *patch) if (lstat(name, &st)) { if (errno != ENOENT) return error(_("%s: %s"), name, strerror(errno)); - if (checkout_target(ce, &st)) + if (checkout_target(&the_index, ce, &st)) return -1; } if (verify_index_match(ce, &st)) @@ -3411,7 +3413,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s } *ce = active_cache[pos]; if (stat_ret < 0) { - if (checkout_target(*ce, st)) + if (checkout_target(&the_index, *ce, st)) return -1; } if (!cached && verify_index_match(*ce, st)) diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 9e49bf2..05edd9e 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -135,6 +135,7 @@ static int option_parse_u(const struct option *opt, int *newfd = opt->value; state.refresh_cache = 1; + state.istate = &the_index; if (*newfd < 0) *newfd = hold_locked_index(&lock_file, 1); return 0; diff --git a/builtin/checkout.c b/builtin/checkout.c index 944a634..146ab91 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -336,6 +336,7 @@ static int checkout_paths(const struct checkout_opts *opts, memset(&state, 0, sizeof(state)); state.force = 1; state.refresh_cache = 1; + state.istate = &the_index; for (pos = 0; pos < active_nr; pos++) { struct cache_entry *ce = active_cache[pos]; if (ce->ce_flags & CE_MATCHED) { diff --git a/cache.h b/cache.h index 4c288e8..9bbebab 100644 --- a/cache.h +++ b/cache.h @@ -1063,6 +1063,7 @@ extern int split_ident_line(struct ident_split *, const char *, int); extern int ident_cmp(const struct ident_split *, const struct ident_split *); struct checkout { + struct index_state *istate; const char *base_dir; int base_dir_len; unsigned force:1, diff --git a/entry.c b/entry.c index 77c6882..d913c1d 100644 --- a/entry.c +++ b/entry.c @@ -210,9 +210,11 @@ static int write_entry(struct cache_entry *ce, finish: if (state->refresh_cache) { + assert(state->istate); if (!fstat_done) lstat(ce->name, &st); fill_stat_cache_info(ce, &st); + state->istate->cache_changed |= CE_ENTRY_CHANGED; } return 0; } diff --git a/unpack-trees.c b/unpack-trees.c index 3beff8a..26f65c7 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1029,6 +1029,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options state.force = 1; state.quiet = 1; state.refresh_cache = 1; + state.istate = &o->result; memset(&el, 0, sizeof(el)); if (!core_apply_sparse_checkout || !o->update) -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 27/32] rev-parse: add --shared-index-path to get shared index path
Normally scripts do not have to be aware about split indexes because all shared indexes are in $GIT_DIR. A simple "mv $tmp_index $GIT_DIR/somewhere" is enough. Scripts that generate temporary indexes and move them across repos must be aware about split index and copy the shared file as well. This option enables that. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-rev-parse.txt | 4 builtin/rev-parse.c | 10 ++ 2 files changed, 14 insertions(+) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 987395d..9bd76a5 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -245,6 +245,10 @@ print a message to stderr and exit with nonzero status. --show-toplevel:: Show the absolute path of the top-level directory. +--shared-index-path:: + Show the path to the shared index file in split index mode, or + empty if not in split-index mode. + Other Options ~ diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 1a6122d..8102aaa 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -11,6 +11,7 @@ #include "parse-options.h" #include "diff.h" #include "revision.h" +#include "split-index.h" #define DO_REVS1 #define DO_NOREV 2 @@ -775,6 +776,15 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) : "false"); continue; } + if (!strcmp(arg, "--shared-index-path")) { + if (read_cache() < 0) + die(_("Could not read the index")); + if (the_index.split_index) { + const unsigned char *sha1 = the_index.split_index->base_sha1; + puts(git_path("sharedindex.%s", sha1_to_hex(sha1))); + } + continue; + } if (starts_with(arg, "--since=")) { show_datestring("--max-age=", arg+8); continue; -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/32] ewah: delete unused ewah_read_mmap_native declaration
Signed-off-by: Nguyễn Thái Ngọc Duy --- ewah/ewok.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ewah/ewok.h b/ewah/ewok.h index 0556ca5..f6ad190 100644 --- a/ewah/ewok.h +++ b/ewah/ewok.h @@ -100,7 +100,6 @@ int ewah_serialize_native(struct ewah_bitmap *self, int fd); int ewah_deserialize(struct ewah_bitmap *self, int fd); int ewah_read_mmap(struct ewah_bitmap *self, const void *map, size_t len); -int ewah_read_mmap_native(struct ewah_bitmap *self, void *map, size_t len); uint32_t ewah_checksum(struct ewah_bitmap *self); -- 1.9.1.346.ga2b5940 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Sleep 1 millisecond in poll() to avoid busy wait
Hello, On Mon, Apr 28, 2014 at 11:07:24AM +0200, Erik Faye-Lund wrote: > compat/poll/poll.c comes from Gnulib, so it would be better to submit > the patch there and update. well, the change is in gnulib since 2012-05-21. But the two versions has diverged a lot. Could you please just accept a backport of this one patch? I would be glad if msysgit could drop this patch. Updated patch follows. Stepan -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] poll/select: prevent busy-waiting
From: Paolo Bonzini Date: Mon, 21 May 2012 09:52:42 +0200 Backported from Gnulib. 2012-05-21 Paolo Bonzini poll/select: prevent busy-waiting. SwitchToThread() only gives away the rest of the current time slice to another thread in the current process. So if the thread that feeds the file decscriptor we're polling is not in the current process, we get busy-waiting. * lib/poll.c: Use SleepEx(1, TRUE) instead of SwitchToThread(). Patch from Theodore Leblond. * lib/select.c: Split polling out of the loop that sets the output fd_sets. Check for zero result and loop if the wait timeout is infinite. Signed-off-by: Stepan Kasal --- compat/poll/poll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/poll/poll.c b/compat/poll/poll.c index 31163f2..a9b41d8 100644 --- a/compat/poll/poll.c +++ b/compat/poll/poll.c @@ -605,7 +605,7 @@ restart: if (!rc && timeout == INFTIM) { - SwitchToThread(); + SleepEx (1, TRUE); goto restart; } -- 1.9.2.msysgit.0.158.g6070cee -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] poll/select: prevent busy-waiting
On Mon, Apr 28, 2014 at 1:42 PM, Stepan Kasal wrote: > From: Paolo Bonzini > Date: Mon, 21 May 2012 09:52:42 +0200 > > Backported from Gnulib. > > 2012-05-21 Paolo Bonzini > > poll/select: prevent busy-waiting. SwitchToThread() only gives away > the rest of the current time slice to another thread in the current > process. So if the thread that feeds the file decscriptor we're > polling is not in the current process, we get busy-waiting. > * lib/poll.c: Use SleepEx(1, TRUE) instead of SwitchToThread(). > Patch from Theodore Leblond. > * lib/select.c: Split polling out of the loop that sets the output > fd_sets. Check for zero result and loop if the wait timeout is > infinite. > > Signed-off-by: Stepan Kasal > --- > compat/poll/poll.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/compat/poll/poll.c b/compat/poll/poll.c > index 31163f2..a9b41d8 100644 > --- a/compat/poll/poll.c > +++ b/compat/poll/poll.c > @@ -605,7 +605,7 @@ restart: > >if (!rc && timeout == INFTIM) > { > - SwitchToThread(); > + SleepEx (1, TRUE); >goto restart; > } > > -- > 1.9.2.msysgit.0.158.g6070cee > Thanks for taking the effort! Acked-by: Erik Faye-Lund -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Felipe Contreras writes: > Jeremy Morton wrote: >> >> Sounds like the default behaviour of "git pull" might not be ideal if >> it easily causes these problems. > > It's not idea. Virtually everyone agrees with that, even Linus > Torvalds, and we have the patches to fix it, but it's not going to > change. > > The Git project doesn't welcome change. I can think of a few other things that "the Git project" or actually pretty much everybody doesn't welcome. It becomes easier to actually change things when communicating in a less abrasive and destructive manner. At any rate, releases involve time plans and testing periods. Personally I think that the automerging behavior of "git pull" is one of the most stupid traps Git has available for beginning contributors to make a royal mess of their contributions. It's unbelievable that this has not been defused a decade ago already. But it hasn't, and such a change is no longer in a useful time frame for a 2.0 release. Unless one wants to push back the 2.0 release considerably for this alone. But then everybody will have a favorite pet peeve, some likely more justified, some less, that he wants to get into 2.0. I mean, I just sped up git-blame for serious use cases by a factor of 3 or so at least, and there will be _no_ API changes and user-visible consequences with that change. So what? If the thing has been important enough to get into 2.0, it has been important enough to push for it _timely_ so that it had a chance at considerable testing exposure. That's what has been done with the "git push" changes. They were put in timely, with quite a bit of warning about what will change and what people are supposed to be doing about it. Again: bad enough that it took as long as that to fix this insanely reckless default. The scale of the git-pull problem is small in comparison as it only messes up a single local branch instead of a whole set of upstream branches. -- David Kastrup -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recording the current branch on each commit?
Jeremy Morton writes: > On 28/04/2014 10:02, David Kastrup wrote: >> Jeremy Morton writes: >> >>> On 28/04/2014 09:32, Felipe Contreras wrote: >> some people to is to always merge with --no-ff, that way you see the >> branch >> name in the merge commit. > > But surely, it's recommended with Git that you try to avoid doing > --no-ff merges to avoid commit noise? Nope. Different people have different needs, there's no recommendation. If anything, the recommendation is to do a ff merge, because that's the default. >>> >>> That's what I'm saying. With an ff merge, you don't get the merge >>> commit message telling you the branch name. >> >> And I don't _want_ that branch name to be recorded. The whole point of >> a distributed version control system is that it's nobody else's business >> how I organize my work before submitting it. > > Well it would be optional, so obviously you wouldn't be forced to > share the branch name. It's not like we're trying to "pry in" to your > private development. It's a way of choosing to share what you may > consider to be useful contextual information about the commit. But it isn't useful contextual information about the commit because it is tied to a particular repository. >> It is _totally_ useless information in a distributed development >> model. Why would or should anybody be concerned what private >> branches some submitter has developed his patches in? > > Why should anybody be concerned about what commit message some > submitter has typed in for his commit? They could just read the > source code to see what has changed, right? The commit message is an integral part of a commit. The contents of the commit message are not tied to a particular repository. The branch name, however, is. > Because the commit message is a way for the submitter to try and make > it easier for the people looking at the commit to understand what the > commit is doing. The commit message is written for an audience and is independent of the repository. The branch name isn't. > In the same way, a meaningful branch name may also make it easier for > people looking at the commit to understand what it is doing, It is nobody's business how I name my branches. I can change the commit message using git commit --amend, but what should happen if I rename the branch a commit is on? And what nightmare should occur when doing git cherry-pick? What _is_ the originating branch of a cherry-pick? What _is_ the originating branch of a merge commit? Or even of a cherry-picked merge commit? > or what part of the application it is affecting, or what group of > commits it is a part of. If I have useful information to offer to the readers of a commit, it belongs in the commit message. Not in some involuntarily created and leaked piece of metadata specific to my workflow and repository that will be awfully hard to change after the fact. -- David Kastrup -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] PAGER_ENV: remove 'S' from $LESS by default
Matthieu Moy writes: > David Kastrup writes: > >> There seem to be a few more occurences (git-sh-setup.sh and pager.c): > > Not since f82c3ffd862c7 (Wed Feb 5 2014, move LESS/LV pager environment > to Makefile). The only upstream branch containing this commit is pu. So this patch should likely not go anywhere else for now. -- David Kastrup -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Tagging a branch as "not fitted for branching" ?
Most manuals on git state that it is bad practice to push -f a branch after have meddled with its history, because this would risk to upset the repositories of the coworkers. On the other hand, some workflows use branches to propose modifications, and need some rewritting of the history after some review steps. In this case, the branch should only be seen as a mere pile of patches. Having this two-sided discourse is often misunderstood by casual git users. The proposed solution would be to be able to flag the branches with a special tag "not fitted for branching" that a collaborator could use when pushing it. This tag would be passed on to any pulled remote. When another collaborator would then issue a "git checkout -b", the command would fail with a warning message, unless forced with '-f'. Is this feature already present? If not, would it be of any interest? Best regards, Jean-Noël AVILA -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] PAGER_ENV: remove 'S' from $LESS by default
David Kastrup writes: > Matthieu Moy writes: > >> David Kastrup writes: >> >>> There seem to be a few more occurences (git-sh-setup.sh and pager.c): >> >> Not since f82c3ffd862c7 (Wed Feb 5 2014, move LESS/LV pager environment >> to Makefile). > > The only upstream branch containing this commit is pu. So this patch > should likely not go anywhere else for now. Oops, indeed, I made my patch on top of pu by mistake. Anyway, my patch can wait for the other series to be merged. Jeff, you're the author of f82c3ffd862c7, topic jk/makefile in git.git, marked "expecting a reroll" by Junio. Any news from the series? -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/14] t0001-init.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t0001-init.sh | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/t0001-init.sh b/t/t0001-init.sh index bbc9cb6..2f30203 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -185,14 +185,14 @@ test_expect_success 'init --bare/--shared overrides system/global config' ' git init --bare --shared=0666 init-bare-shared-override && check_config init-bare-shared-override true unset && test x0666 = \ - x`git config -f init-bare-shared-override/config core.sharedRepository` + x$(git config -f init-bare-shared-override/config core.sharedRepository) ' test_expect_success 'init honors global core.sharedRepository' ' test_config_global core.sharedRepository 0666 && git init shared-honor-global && test x0666 = \ - x`git config -f shared-honor-global/.git/config core.sharedRepository` + x$(git config -f shared-honor-global/.git/config core.sharedRepository) ' test_expect_success 'init rejects insanely long --template' ' @@ -285,7 +285,7 @@ test_expect_success 'init prefers command line to GIT_DIR' ' test_expect_success 'init with separate gitdir' ' rm -rf newdir && git init --separate-git-dir realgitdir newdir && - echo "gitdir: `pwd`/realgitdir" >expected && + echo "gitdir: $(pwd)/realgitdir" >expected && test_cmp expected newdir/.git && test_path_is_dir realgitdir/refs ' @@ -299,7 +299,7 @@ test_expect_success 're-init to update git link' ' cd newdir && git init --separate-git-dir ../surrealgitdir ) && - echo "gitdir: `pwd`/surrealgitdir" >expected && + echo "gitdir: $(pwd)/surrealgitdir" >expected && test_cmp expected newdir/.git && test_path_is_dir surrealgitdir/refs && test_path_is_missing realgitdir/refs @@ -312,7 +312,7 @@ test_expect_success 're-init to move gitdir' ' cd newdir && git init --separate-git-dir ../realgitdir ) && - echo "gitdir: `pwd`/realgitdir" >expected && + echo "gitdir: $(pwd)/realgitdir" >expected && test_cmp expected newdir/.git && test_path_is_dir realgitdir/refs ' @@ -326,7 +326,7 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' ' ln -s here .git && git init --separate-git-dir ../realgitdir ) && - echo "gitdir: `pwd`/realgitdir" >expected && + echo "gitdir: $(pwd)/realgitdir" >expected && test_cmp expected newdir/.git && test_cmp expected newdir/here && test_path_is_dir realgitdir/refs -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/14] t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t1002-read-tree-m-u-2way.sh | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh index a847709..fed877b 100755 --- a/t/t1002-read-tree-m-u-2way.sh +++ b/t/t1002-read-tree-m-u-2way.sh @@ -21,7 +21,7 @@ compare_change () { } check_cache_at () { - clean_if_empty=`git diff-files -- "$1"` + clean_if_empty=$(git diff-files -- "$1") case "$clean_if_empty" in '') echo "$1: clean" ;; ?*) echo "$1: dirty" ;; @@ -41,14 +41,14 @@ test_expect_success \ echo bozbar >bozbar && echo rezrov >rezrov && git update-index --add nitfol bozbar rezrov && - treeH=`git write-tree` && + treeH=$(git write-tree) && echo treeH $treeH && git ls-tree $treeH && echo gnusto >bozbar && git update-index --add frotz bozbar --force-remove rezrov && git ls-files --stage >M.out && - treeM=`git write-tree` && + treeM=$(git write-tree) && echo treeM $treeM && git ls-tree $treeM && sum bozbar frotz nitfol >M.sum && @@ -318,7 +318,7 @@ test_expect_success \ 'rm -f .git/index && echo DF >DF && git update-index --add DF && - treeDF=`git write-tree` && + treeDF=$(git write-tree) && echo treeDF $treeDF && git ls-tree $treeDF && @@ -326,7 +326,7 @@ test_expect_success \ mkdir DF && echo DF/DF >DF/DF && git update-index --add --remove DF DF/DF && - treeDFDF=`git write-tree` && + treeDFDF=$(git write-tree) && echo treeDFDF $treeDFDF && git ls-tree $treeDFDF && git ls-files --stage >DFDF.out' -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/14] t0010-racy-git.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t0010-racy-git.sh |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t0010-racy-git.sh b/t/t0010-racy-git.sh index e45a9e4..5657c5a 100755 --- a/t/t0010-racy-git.sh +++ b/t/t0010-racy-git.sh @@ -14,7 +14,7 @@ do git update-index --add infocom echo xyzzy >infocom - files=`git diff-files -p` + files=$(git diff-files -p) test_expect_success \ "Racy GIT trial #$trial part A" \ 'test "" != "$files"' @@ -23,7 +23,7 @@ do echo xyzzy >cornerstone git update-index --add cornerstone - files=`git diff-files -p` + files=$(git diff-files -p) test_expect_success \ "Racy GIT trial #$trial part B" \ 'test "" != "$files"' -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/14] t0020-crlf.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t0020-crlf.sh | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index e526184..d2e51a8 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -20,14 +20,14 @@ test_expect_success setup ' git commit -m initial && - one=`git rev-parse HEAD:one` && - dir=`git rev-parse HEAD:dir` && - two=`git rev-parse HEAD:dir/two` && - three=`git rev-parse HEAD:three` && + one=$(git rev-parse HEAD:one) && + dir=$(git rev-parse HEAD:dir) && + two=$(git rev-parse HEAD:dir/two) && + three=$(git rev-parse HEAD:three) && for w in Some extra lines here; do echo $w; done >>one && git diff >patch.file && - patched=`git hash-object --stdin http://vger.kernel.org/majordomo-info.html
[PATCH 14/14] t1050-large.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t1050-large.sh |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t1050-large.sh b/t/t1050-large.sh index fd10528..aea4936 100755 --- a/t/t1050-large.sh +++ b/t/t1050-large.sh @@ -131,7 +131,7 @@ test_expect_success 'git-show a large file' ' ' test_expect_success 'index-pack' ' - git clone file://"`pwd`"/.git foo && + git clone file://"$(pwd)"/.git foo && GIT_DIR=non-existent git index-pack --strict --verify foo/.git/objects/pack/*.pack ' @@ -140,7 +140,7 @@ test_expect_success 'repack' ' ' test_expect_success 'pack-objects with large loose object' ' - SHA1=`git hash-object huge` && + SHA1=$(git hash-object huge) && test_create_repo loose && echo $SHA1 | git pack-objects --stdout | GIT_ALLOC_LIMIT=0 GIT_DIR=loose/.git git unpack-objects && -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/14] t1020-subdirectory.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t1020-subdirectory.sh | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh index 6902320..62c0d25 100755 --- a/t/t1020-subdirectory.sh +++ b/t/t1020-subdirectory.sh @@ -20,27 +20,27 @@ test_expect_success setup ' test_expect_success 'update-index and ls-files' ' git update-index --add one && - case "`git ls-files`" in + case "$(git ls-files)" in one) echo pass one ;; *) echo bad one; exit 1 ;; esac && ( cd dir && git update-index --add two && - case "`git ls-files`" in + case "$(git ls-files)" in two) echo pass two ;; *) echo bad two; exit 1 ;; esac ) && - case "`git ls-files`" in + case "$(git ls-files)" in dir/two"$LF"one) echo pass both ;; *) echo bad; exit 1 ;; esac ' test_expect_success 'cat-file' ' - two=`git ls-files -s dir/two` && - two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` && + two=$(git ls-files -s dir/two) && + two=$(expr "$two" : "[0-7]* \\([0-9a-f]*\\)") && echo "$two" && git cat-file -p "$two" >actual && cmp dir/two actual && @@ -55,18 +55,18 @@ rm -f actual dir/actual test_expect_success 'diff-files' ' echo a >>one && echo d >>dir/two && - case "`git diff-files --name-only`" in + case "$(git diff-files --name-only)" in dir/two"$LF"one) echo pass top ;; *) echo bad top; exit 1 ;; esac && # diff should not omit leading paths ( cd dir && - case "`git diff-files --name-only`" in + case "$(git diff-files --name-only)" in dir/two"$LF"one) echo pass subdir ;; *) echo bad subdir; exit 1 ;; esac && - case "`git diff-files --name-only .`" in + case "$(git diff-files --name-only .)" in dir/two) echo pass subdir limited ;; *) echo bad subdir limited; exit 1 ;; esac @@ -74,11 +74,11 @@ test_expect_success 'diff-files' ' ' test_expect_success 'write-tree' ' - top=`git write-tree` && + top=$(git write-tree) && echo $top && ( cd dir && - sub=`git write-tree` && + sub=$(git write-tree) && echo $sub && test "z$top" = "z$sub" ) @@ -96,7 +96,7 @@ test_expect_success 'checkout-index' ' test_expect_success 'read-tree' ' rm -f one dir/two && - tree=`git write-tree` && + tree=$(git write-tree) && read_tree_u_must_succeed --reset -u "$tree" && cmp one original.one && cmp dir/two original.two && -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/14] t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t1003-read-tree-prefix.sh |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1003-read-tree-prefix.sh b/t/t1003-read-tree-prefix.sh index 8c6d67e..b6111cd 100755 --- a/t/t1003-read-tree-prefix.sh +++ b/t/t1003-read-tree-prefix.sh @@ -11,7 +11,7 @@ test_description='git read-tree --prefix test. test_expect_success setup ' echo hello >one && git update-index --add one && - tree=`git write-tree` && + tree=$(git write-tree) && echo tree is $tree ' -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/14] t0025-crlf-auto.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t0025-crlf-auto.sh | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/t/t0025-crlf-auto.sh b/t/t0025-crlf-auto.sh index f5f67a6..b0e5694 100755 --- a/t/t0025-crlf-auto.sh +++ b/t/t0025-crlf-auto.sh @@ -19,9 +19,9 @@ test_expect_success setup ' git commit -m initial && - one=`git rev-parse HEAD:one` && - two=`git rev-parse HEAD:two` && - three=`git rev-parse HEAD:three` && + one=$(git rev-parse HEAD:one) && + two=$(git rev-parse HEAD:two) && + three=$(git rev-parse HEAD:three) && echo happy. ' @@ -33,9 +33,9 @@ test_expect_success 'default settings cause no changes' ' ! has_cr one && has_cr two && - onediff=`git diff one` && - twodiff=`git diff two` && - threediff=`git diff three` && + onediff=$(git diff one) && + twodiff=$(git diff two) && + threediff=$(git diff three) && test -z "$onediff" -a -z "$twodiff" -a -z "$threediff" ' @@ -48,7 +48,7 @@ test_expect_success 'crlf=true causes a CRLF file to be normalized' ' # Note, "normalized" means that git will normalize it if added has_cr two && - twodiff=`git diff two` && + twodiff=$(git diff two) && test -n "$twodiff" ' @@ -60,7 +60,7 @@ test_expect_success 'text=true causes a CRLF file to be normalized' ' # Note, "normalized" means that git will normalize it if added has_cr two && - twodiff=`git diff two` && + twodiff=$(git diff two) && test -n "$twodiff" ' @@ -72,7 +72,7 @@ test_expect_success 'eol=crlf gives a normalized file CRLFs with autocrlf=false' git read-tree --reset -u HEAD && has_cr one && - onediff=`git diff one` && + onediff=$(git diff one) && test -z "$onediff" ' @@ -84,7 +84,7 @@ test_expect_success 'eol=crlf gives a normalized file CRLFs with autocrlf=input' git read-tree --reset -u HEAD && has_cr one && - onediff=`git diff one` && + onediff=$(git diff one) && test -z "$onediff" ' @@ -96,7 +96,7 @@ test_expect_success 'eol=lf gives a normalized file LFs with autocrlf=true' ' git read-tree --reset -u HEAD && ! has_cr one && - onediff=`git diff one` && + onediff=$(git diff one) && test -z "$onediff" ' @@ -108,9 +108,9 @@ test_expect_success 'autocrlf=true does not normalize CRLF files' ' has_cr one && has_cr two && - onediff=`git diff one` && - twodiff=`git diff two` && - threediff=`git diff three` && + onediff=$(git diff one) && + twodiff=$(git diff two) && + threediff=$(git diff three) && test -z "$onediff" -a -z "$twodiff" -a -z "$threediff" ' @@ -123,9 +123,9 @@ test_expect_success 'text=auto, autocrlf=true _does_ normalize CRLF files' ' has_cr one && has_cr two && - onediff=`git diff one` && - twodiff=`git diff two` && - threediff=`git diff three` && + onediff=$(git diff one) && + twodiff=$(git diff two) && + threediff=$(git diff three) && test -z "$onediff" -a -n "$twodiff" -a -z "$threediff" ' @@ -137,7 +137,7 @@ test_expect_success 'text=auto, autocrlf=true does not normalize binary files' ' git read-tree --reset -u HEAD && ! has_cr three && - threediff=`git diff three` && + threediff=$(git diff three) && test -z "$threediff" ' @@ -148,7 +148,7 @@ test_expect_success 'eol=crlf _does_ normalize binary files' ' git read-tree --reset -u HEAD && has_cr three && - threediff=`git diff three` && + threediff=$(git diff three) && test -z "$threediff" ' -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/14] t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t1001-read-tree-m-2way.sh | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh index 3a24abf..db1b6f5 100755 --- a/t/t1001-read-tree-m-2way.sh +++ b/t/t1001-read-tree-m-2way.sh @@ -36,7 +36,7 @@ compare_change () { } check_cache_at () { - clean_if_empty=`git diff-files -- "$1"` + clean_if_empty=$(git diff-files -- "$1") case "$clean_if_empty" in '') echo "$1: clean" ;; ?*) echo "$1: dirty" ;; @@ -68,14 +68,14 @@ test_expect_success \ echo rezrov >rezrov && echo yomin >yomin && git update-index --add nitfol bozbar rezrov && - treeH=`git write-tree` && + treeH=$(git write-tree) && echo treeH $treeH && git ls-tree $treeH && cat bozbar-new >bozbar && git update-index --add frotz bozbar --force-remove rezrov && git ls-files --stage >M.out && - treeM=`git write-tree` && + treeM=$(git write-tree) && echo treeM $treeM && git ls-tree $treeM && git diff-tree $treeH $treeM' @@ -315,7 +315,7 @@ test_expect_success \ 'rm -f .git/index && echo DF >DF && git update-index --add DF && - treeDF=`git write-tree` && + treeDF=$(git write-tree) && echo treeDF $treeDF && git ls-tree $treeDF && @@ -323,7 +323,7 @@ test_expect_success \ mkdir DF && echo DF/DF >DF/DF && git update-index --add --remove DF DF/DF && - treeDFDF=`git write-tree` && + treeDFDF=$(git write-tree) && echo treeDFDF $treeDFDF && git ls-tree $treeDFDF && git ls-files --stage >DFDF.out' @@ -345,7 +345,7 @@ test_expect_success \ 'rm -f .git/index && : >a && git update-index --add a && - treeM=`git write-tree` && + treeM=$(git write-tree) && echo treeM $treeM && git ls-tree $treeM && git ls-files --stage >treeM.out && @@ -354,7 +354,7 @@ test_expect_success \ git update-index --remove a && mkdir a && : >a/b && - treeH=`git write-tree` && + treeH=$(git write-tree) && echo treeH $treeH && git ls-tree $treeH' @@ -372,7 +372,7 @@ test_expect_success \ mkdir c && : >c/d && git update-index --add a c/d && - treeM=`git write-tree` && + treeM=$(git write-tree) && echo treeM $treeM && git ls-tree $treeM && git ls-files --stage >treeM.out && @@ -381,7 +381,7 @@ test_expect_success \ mkdir a && : >a/b && git update-index --add --remove a a/b && - treeH=`git write-tree` && + treeH=$(git write-tree) && echo treeH $treeH && git ls-tree $treeH' -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/14] t1000-read-tree-m-3way.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t1000-read-tree-m-3way.sh |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh index babcdd2..a0b79b4 100755 --- a/t/t1000-read-tree-m-3way.sh +++ b/t/t1000-read-tree-m-3way.sh @@ -519,10 +519,10 @@ test_expect_success \ 'rm -f .git/index F16 && echo F16 >F16 && git update-index --add F16 && -tree0=`git write-tree` && +tree0=$(git write-tree) && echo E16 >F16 && git update-index F16 && -tree1=`git write-tree` && +tree1=$(git write-tree) && read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 && git ls-files --stage' -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/14] t0026-eol-config.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t0026-eol-config.sh | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh index fe0164b..e1126aa 100755 --- a/t/t0026-eol-config.sh +++ b/t/t0026-eol-config.sh @@ -20,8 +20,8 @@ test_expect_success setup ' git commit -m initial && - one=`git rev-parse HEAD:one` && - two=`git rev-parse HEAD:two` && + one=$(git rev-parse HEAD:one) && + two=$(git rev-parse HEAD:two) && echo happy. ' @@ -34,8 +34,8 @@ test_expect_success 'eol=lf puts LFs in normalized file' ' ! has_cr one && ! has_cr two && - onediff=`git diff one` && - twodiff=`git diff two` && + onediff=$(git diff one) && + twodiff=$(git diff two) && test -z "$onediff" -a -z "$twodiff" ' @@ -47,8 +47,8 @@ test_expect_success 'eol=crlf puts CRLFs in normalized file' ' has_cr one && ! has_cr two && - onediff=`git diff one` && - twodiff=`git diff two` && + onediff=$(git diff one) && + twodiff=$(git diff two) && test -z "$onediff" -a -z "$twodiff" ' @@ -61,8 +61,8 @@ test_expect_success 'autocrlf=true overrides eol=lf' ' has_cr one && has_cr two && - onediff=`git diff one` && - twodiff=`git diff two` && + onediff=$(git diff one) && + twodiff=$(git diff two) && test -z "$onediff" -a -z "$twodiff" ' @@ -75,8 +75,8 @@ test_expect_success 'autocrlf=true overrides unset eol' ' has_cr one && has_cr two && - onediff=`git diff one` && - twodiff=`git diff two` && + onediff=$(git diff one) && + twodiff=$(git diff two) && test -z "$onediff" -a -z "$twodiff" ' -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/14] t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t1004-read-tree-m-u-wf.sh |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh index 3e72aff..c70cf42 100755 --- a/t/t1004-read-tree-m-u-wf.sh +++ b/t/t1004-read-tree-m-u-wf.sh @@ -30,7 +30,7 @@ test_expect_success 'two-way not clobbering' ' echo >file2 master creates untracked file2 && echo >subdir/file2 master creates untracked subdir/file2 && - if err=`read_tree_u_must_succeed -m -u master side 2>&1` + if err=$(read_tree_u_must_succeed -m -u master side 2>&1) then echo should have complained false @@ -43,7 +43,7 @@ echo file2 >.gitignore test_expect_success 'two-way with incorrect --exclude-per-directory (1)' ' - if err=`read_tree_u_must_succeed -m --exclude-per-directory=.gitignore master side 2>&1` + if err=$(read_tree_u_must_succeed -m --exclude-per-directory=.gitignore master side 2>&1) then echo should have complained false @@ -54,7 +54,7 @@ test_expect_success 'two-way with incorrect --exclude-per-directory (1)' ' test_expect_success 'two-way with incorrect --exclude-per-directory (2)' ' - if err=`read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1` + if err=$(read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1) then echo should have complained false @@ -95,7 +95,7 @@ test_expect_success 'three-way not clobbering a working tree file' ' git checkout master && echo >file3 file three created in master, untracked && echo >subdir/file3 file three created in master, untracked && - if err=`read_tree_u_must_succeed -m -u branch-point master side 2>&1` + if err=$(read_tree_u_must_succeed -m -u branch-point master side 2>&1) then echo should have complained false -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/14] t0300-credentials.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t0300-credentials.sh |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh index 538ea5f..57ea5a1 100755 --- a/t/t0300-credentials.sh +++ b/t/t0300-credentials.sh @@ -6,7 +6,7 @@ test_description='basic credential helper tests' test_expect_success 'setup helper scripts' ' cat >dump <<-\EOF && - whoami=`echo $0 | sed s/.*git-credential-//` + whoami=$(echo $0 | sed s/.*git-credential-//) echo >&2 "$whoami: $*" OIFS=$IFS IFS== -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/14] t0030-stripspace.sh: use the $( ... ) construct for command substitution
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done and then carefully proof-read. Signed-off-by: Elia Pinto --- t/t0030-stripspace.sh | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh index a8e84d8..0333dd9 100755 --- a/t/t0030-stripspace.sh +++ b/t/t0030-stripspace.sh @@ -225,22 +225,22 @@ test_expect_success \ test_expect_success \ 'text without newline at end should end with newline' ' -test `printf "$ttt" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$ttt" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$ttt$ttt" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l` -gt 0 +test $(printf "$ttt" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$ttt" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 ' # text plus spaces at the end: test_expect_success \ 'text plus spaces without newline at end should end with newline' ' -test `printf "$ttt$sss" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$sss$sss" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$ttt$sss$sss" | git stripspace | wc -l` -gt 0 && -test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0 +test $(printf "$ttt$sss" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$sss$sss" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$ttt$sss$sss" | git stripspace | wc -l) -gt 0 && +test $(printf "$ttt$sss$sss$sss" | git stripspace | wc -l) -gt 0 ' test_expect_success \ -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git version 1.9.0 missing git-http-push?
On Mon, Apr 28, 2014 at 11:01 AM, Erik Faye-Lund wrote: > On Mon, Apr 28, 2014 at 10:48 AM, Erik Faye-Lund wrote: >> So it seems that 08900987 ("Decide whether to build http-push in the >> Makefile") makes a bad assumption about the availability of >> curl-config on new libcurl installations; it's not present on "stock" >> Windows builds. > > I wonder, though. That check is over 8 years old. Are that old systems > (that haven't been upgraded) still able to build Git? Even my old > RedHat 5 setup has curl 7.15.5... > > Perhaps the following is the right thing to do? If not, perhaps we > could move this complication to configure.ac, which could get the > version number from the header-file instead? That way, quirks only > affect quirky systems... > > (white-space damaged, I'll post a proper patch if there's some agreement) > --- > > diff --git a/Makefile b/Makefile > index 29a555d..6da72e7 100644 > --- a/Makefile > +++ b/Makefile > @@ -1133,13 +1133,8 @@ else > REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) > PROGRAM_OBJS += http-fetch.o > PROGRAMS += $(REMOTE_CURL_NAMES) > -curl_check := $(shell (echo 070908; curl-config --vernum) > 2>/dev/null | sort -r | sed -ne 2p) > -ifeq "$(curl_check)" "070908" > -ifndef NO_EXPAT > -PROGRAM_OBJS += http-push.o > -endif > -endif > ifndef NO_EXPAT > +PROGRAM_OBJS += http-push.o > ifdef EXPATDIR > BASIC_CFLAGS += -I$(EXPATDIR)/include > EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) > $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat I've built an installer with this patch applied, and it seems to do the trick: https://dl.dropboxusercontent.com/u/1737924/Git-1.9.2-http-push.exe -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [msysGit] Re: git version 1.9.0 missing git-http-push?
Hi kusma, On Mon, 28 Apr 2014, Erik Faye-Lund wrote: > On Mon, Apr 28, 2014 at 10:48 AM, Erik Faye-Lund wrote: > > So it seems that 08900987 ("Decide whether to build http-push in the > > Makefile") makes a bad assumption about the availability of > > curl-config on new libcurl installations; it's not present on "stock" > > Windows builds. > > I wonder, though. That check is over 8 years old. Are that old systems > (that haven't been upgraded) still able to build Git? Even my old > RedHat 5 setup has curl 7.15.5... The easiest way in my humble opinion would be to install a script like this into /mingw/bin/: -- snip -- #!/bin/sh case "$1" in --vernum) version="$(curl -V)" || exit version="$(echo "${version%% (*)*}" | tr . \ )" eval printf "%02d%02d%02d" ${version#curl } ;; --cflags) ;; --libs) echo -lcurl ;; esac -- snap -- That way, upstream Git does not have anything to change (and we avoid discussing five versions of essentially the same patch :-P). Hmm? Ciao, Dscho -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [msysGit] Re: git version 1.9.0 missing git-http-push?
On Mon, Apr 28, 2014 at 3:20 PM, Johannes Schindelin wrote: > Hi kusma, > > On Mon, 28 Apr 2014, Erik Faye-Lund wrote: > >> On Mon, Apr 28, 2014 at 10:48 AM, Erik Faye-Lund wrote: >> > So it seems that 08900987 ("Decide whether to build http-push in the >> > Makefile") makes a bad assumption about the availability of >> > curl-config on new libcurl installations; it's not present on "stock" >> > Windows builds. >> >> I wonder, though. That check is over 8 years old. Are that old systems >> (that haven't been upgraded) still able to build Git? Even my old >> RedHat 5 setup has curl 7.15.5... > > The easiest way in my humble opinion would be to install a script like > this into /mingw/bin/: > > -- snip -- > #!/bin/sh > > case "$1" in > --vernum) > version="$(curl -V)" || exit > version="$(echo "${version%% (*)*}" | tr . \ )" > eval printf "%02d%02d%02d" ${version#curl } > ;; > --cflags) > ;; > --libs) > echo -lcurl > ;; > esac > -- snap -- > > That way, upstream Git does not have anything to change (and we avoid > discussing five versions of essentially the same patch :-P). Huh? I think I only really proposed one patch...? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Opensource programs. ReactOS Community Edition.
As you may know ReactOS is now working in the new ReactOS Community Edition. It's a new OS, with new features, redesigned image, powered by the new ReactOS kernel which boosts its compatibility with apps and drivers. You can see a comparative, and the new site here: http://community.reactos.org/index.php/features/reactos-0-4 In the spirit of open source we created a special "Open Source Support Program" available only for open source projects. And, of course, absolutely free. Its main objective is to promote your app and show the users that there are "other" alternatives out there and apps waiting to be discovered! But not only that, there are other nice features that you shouldn't miss, because they are free after all. We've (literally) chained a designer into a dark wet basement for a week to create some designs which explain not just the "Opensource Support Program", but also the "Official Software Support" program, which you can join for free too. Make him happy by watching his artwork! http://community.reactos.org/programs/opensource.pdf We hope you will like and consider joining any of these new programs. Since we're planning ahead, we had to set some deadlines in the doc. Don't miss the date! Any comments, suggestions and enhancements are really appreciated so we can expand the features and make them even better. Also we're crowdfunding right now to make ReactOS Community Edition happen ASAP, so any help in spreading the word is most welcome! http://igg.me/at/reactos/x/6842466 Thank you for reading and for "reacting" to the email ;) Disclaimer: No designer was harmed in the making of the attached document. He is recovering well! ;) Víctor Martínez Calvo (EN/ES/DE/FR) Programs & Partnerships Coordinator http://community.reactos.org -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [msysGit] Re: git version 1.9.0 missing git-http-push?
On Mon, Apr 28, 2014 at 03:20:46PM +0200, Johannes Schindelin wrote: > That way, upstream Git does not have anything to change (and we avoid > discussing five versions of essentially the same patch :-P). This bug isn't specific to msysGit but also affects all environments where curl-config is not available or cannot be run for some reason, for example during cross-compilation. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/12] MINGW: config.mak.uname: add explicit way to request MinGW-build
When crosscompiling, one cannot rely on `uname` from host system. Thus, add an option to use `make MINGW=1` for building MinGW build from non-MinGW host (Linux, for example). Signed-off-by: Marat Radchenko --- config.mak.uname | 5 + 1 file changed, 5 insertions(+) diff --git a/config.mak.uname b/config.mak.uname index 23a8803..5d301da 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -13,6 +13,11 @@ ifdef MSVC uname_O := Windows endif +ifdef MINGW + uname_S := MINGW + uname_O := MINGW +endif + # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If # we had "elif" things would have been much nicer... -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/12] MINGW: compat/bswap.h: include stdint.h
bswap.h uses uint32_t type which might not be defined. This patch adds direct include so bswap.h can be safely included. Signed-off-by: Marat Radchenko --- compat/bswap.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/bswap.h b/compat/bswap.h index 120c6c1..d170447 100644 --- a/compat/bswap.h +++ b/compat/bswap.h @@ -5,6 +5,8 @@ * operation. */ +#include + /* * Default version that the compiler ought to optimize properly with * constant values. -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/12] MINGW: git-compat-util.h: use inttypes.h for printf macros.
Also, pass -D__USE_MINGW_ANSI_STDIO=0 to select MSVCRT-compatible macro definitions. Signed-off-by: Marat Radchenko --- compat/mingw.h| 2 -- compat/msvc.h | 3 +++ config.mak.uname | 3 ++- git-compat-util.h | 11 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/compat/mingw.h b/compat/mingw.h index 262b300..c502a22 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -342,8 +342,6 @@ static inline char *mingw_find_last_dir_sep(const char *path) } #define find_last_dir_sep mingw_find_last_dir_sep #define PATH_SEP ';' -#define PRIuMAX "I64u" -#define PRId64 "I64d" void mingw_open_html(const char *path); #define open_html mingw_open_html diff --git a/compat/msvc.h b/compat/msvc.h index 580bb55..cb41ce3 100644 --- a/compat/msvc.h +++ b/compat/msvc.h @@ -15,6 +15,9 @@ #define strtoull _strtoui64 #define strtoll _strtoi64 +#define PRIuMAX "I64u" +#define PRId64 "I64d" + static __inline int strcasecmp (const char *s1, const char *s2) { int size1 = strlen(s1); diff --git a/config.mak.uname b/config.mak.uname index 6c2e6df..e5edae6 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -321,6 +321,7 @@ ifeq ($(uname_S),Windows) NO_PREAD = YesPlease NEEDS_CRYPTO_WITH_SSL = YesPlease NO_LIBGEN_H = YesPlease + NO_INTTYPES_H = UnfortunatelyYes NO_POLL = YesPlease NO_SYMLINK_HEAD = YesPlease NO_IPV6 = YesPlease @@ -502,7 +503,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes DEFAULT_HELP_FORMAT = html - COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32 + COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/winansi.o \ compat/win32/pthread.o compat/win32/syslog.o \ diff --git a/git-compat-util.h b/git-compat-util.h index f6d3a46..aa57a04 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -85,6 +85,12 @@ #define _NETBSD_SOURCE 1 #define _SGI_SOURCE 1 +#ifndef NO_INTTYPES_H +#include +#else +#include +#endif + #if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */ # if defined (_MSC_VER) && !defined(_WIN32_WINNT) # define _WIN32_WINNT 0x0502 @@ -146,11 +152,6 @@ #include #include #include -#ifndef NO_INTTYPES_H -#include -#else -#include -#endif #ifdef NO_INTPTR_T /* * On I16LP32, ILP32 and LP64 "long" is the save bet, however -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/12] MINGW: config.mak.uname: reorganize MINGW settings
HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to msysGit, they're general MinGW settings. Signed-off-by: Marat Radchenko --- config.mak.uname | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index dc87e21..2f1939e 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -521,13 +521,13 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT)) prefix = INSTALL = /bin/install EXTLIBS += /mingw/lib/libz.a - NO_R_TO_GCC_LINKER = YesPlease INTERNAL_QSORT = YesPlease - HAVE_LIBCHARSET_H = YesPlease NO_GETTEXT = YesPlease else NO_CURL = YesPlease endif + HAVE_LIBCHARSET_H = YesPlease + NO_R_TO_GCC_LINKER = YesPlease endif ifeq ($(uname_S),QNX) COMPAT_CFLAGS += -DSA_RESTART=0 -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/12] MINGW: config.mak.uname: drop -DNOGDI
On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI. Unfortunately, including wingdi.h brings in #define ERROR 0 which conflicts with several Git internal enums. So, #undef ERROR. Signed-off-by: Marat Radchenko --- config.mak.uname | 4 ++-- git-compat-util.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index a376b32..4883fd5 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -363,7 +363,7 @@ ifeq ($(uname_S),Windows) COMPAT_OBJS = compat/msvc.o compat/winansi.o \ compat/win32/pthread.o compat/win32/syslog.o \ compat/win32/dirent.o - COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" + COMPAT_CFLAGS = -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj PTHREAD_LIBS = @@ -503,7 +503,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_INET_NTOP = YesPlease NO_POSIX_GOODIES = UnfortunatelyYes DEFAULT_HELP_FORMAT = html - COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32 + COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -Icompat -Icompat/win32 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/winansi.o \ compat/win32/pthread.o compat/win32/syslog.o \ diff --git a/git-compat-util.h b/git-compat-util.h index aa57a04..48bf0f7 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -98,6 +98,8 @@ #define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */ #include #include +/* wingdi.h defines ERROR=0, undef it to avoid conflicts */ +#undef ERROR #define GIT_WINDOWS_NATIVE #endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/12] MINGW: config.mak.uname allow using CURL for non-msysGit builds
Also, fix `warning: passing argument 2 of 'mingw_main' from incompatible pointer type` in http-fetch.c and remote-curl.c. Signed-off-by: Marat Radchenko --- config.mak.uname | 2 -- http-fetch.c | 5 +++-- remote-curl.c| 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index 2f1939e..a376b32 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -523,8 +523,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT)) EXTLIBS += /mingw/lib/libz.a INTERNAL_QSORT = YesPlease NO_GETTEXT = YesPlease -else - NO_CURL = YesPlease endif HAVE_LIBCHARSET_H = YesPlease NO_R_TO_GCC_LINKER = YesPlease diff --git a/http-fetch.c b/http-fetch.c index ba3ea10..a6a9a2f 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -6,7 +6,7 @@ static const char http_fetch_usage[] = "git http-fetch " "[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url"; -int main(int argc, const char **argv) +int main(int argc, char **argv) { struct walker *walker; int commits_on_stdin = 0; @@ -38,7 +38,8 @@ int main(int argc, const char **argv) } else if (argv[arg][1] == 'v') { get_verbosely = 1; } else if (argv[arg][1] == 'w') { - write_ref = &argv[arg + 1]; + const char *ref = argv[arg + 1]; + write_ref = &ref; arg++; } else if (argv[arg][1] == 'h') { usage(http_fetch_usage); diff --git a/remote-curl.c b/remote-curl.c index 52c2d96..565b6c9 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -938,7 +938,7 @@ static void parse_push(struct strbuf *buf) free(specs); } -int main(int argc, const char **argv) +int main(int argc, char **argv) { struct strbuf buf = STRBUF_INIT; int nongit; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/12] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from compile definitions
-D__USE_MINGW_ACCESS only affects MinGW and does nothing when MSVC is used. Signed-off-by: Marat Radchenko --- config.mak.uname | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mak.uname b/config.mak.uname index e5edae6..dc87e21 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -363,7 +363,7 @@ ifeq ($(uname_S),Windows) COMPAT_OBJS = compat/msvc.o compat/winansi.o \ compat/win32/pthread.o compat/win32/syslog.o \ compat/win32/dirent.o - COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" + COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj PTHREAD_LIBS = -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/12] Makefile: introduce CROSS_COMPILE variable
To ease cross-compilation process, introduce a single variable with the prefix to all compiler-related executables. Signed-off-by: Marat Radchenko --- Makefile | 13 + config.mak.uname | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 74a929b..24befc2 100644 --- a/Makefile +++ b/Makefile @@ -350,6 +350,10 @@ all:: # # Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not # return NULL when it receives a bogus time_t. +# +# Define CROSS_COMPILE to specify the prefix used for all executables used +# during compilation. Only gcc and related bin-utils executables +# are prefixed with $(CROSS_COMPILE). GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -361,7 +365,6 @@ CFLAGS = -g -O2 -Wall LDFLAGS = ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS) -STRIP ?= strip # Among the variables below, these: # gitexecdir @@ -401,8 +404,11 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir)) export prefix bindir sharedir sysconfdir gitwebdir localedir -CC = cc -AR = ar +AR = $(CROSS_COMPILE)ar +CC = $(CROSS_COMPILE)cc +GCOV = $(CROSS_COMPILE)gcov +STRIP = $(CROSS_COMPILE)strip + RM = rm -f DIFF = diff TAR = tar @@ -415,7 +421,6 @@ XGETTEXT = xgettext MSGFMT = msgfmt PTHREAD_LIBS = -lpthread PTHREAD_CFLAGS = -GCOV = gcov export TCL_PATH TCLTK_PATH diff --git a/config.mak.uname b/config.mak.uname index 5d301da..6c2e6df 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -511,7 +511,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) EXTLIBS += -lws2_32 GITLIBS += git.res PTHREAD_LIBS = - RC = windres -O coff + RC = $(CROSS_COMPILE)windres -O coff NATIVE_CRLF = YesPlease X = .exe SPARSE_FLAGS = -Wno-one-bit-signed-bitfield -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/14] t0001-init.sh: use the $( ... ) construct for command substitution
Patches 1 to 14/14 are Reviewed-by: Matthieu Moy (in mailer and then log -p --color-words) -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [msysGit] Re: git version 1.9.0 missing git-http-push?
On Mon, Apr 28, 2014 at 3:47 PM, Marat Radchenko wrote: > On Mon, Apr 28, 2014 at 03:20:46PM +0200, Johannes Schindelin wrote: >> That way, upstream Git does not have anything to change (and we avoid >> discussing five versions of essentially the same patch :-P). > > This bug isn't specific to msysGit but also affects all environments > where curl-config is not available or cannot be run for some reason, > for example during cross-compilation. True. I think the assumption simply was a bad one, and it has probably gone unnoticed for a while because pushing over WebDAV is not all that common. If anyone turns up a system with an old enough libcurl, they should probably consult curlver.h instead. And if so, they are probably on a system so crippled they need to run automake anyway. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/12] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64
mingw-w64 has lseek defined in io.h. Signed-off-by: Marat Radchenko --- compat/mingw.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/mingw.h b/compat/mingw.h index e033e72..262b300 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -265,7 +265,9 @@ static inline int getrlimit(int resource, struct rlimit *rlp) * Use mingw specific stat()/lstat()/fstat() implementations on Windows. */ #define off_t off64_t +#ifndef lseek #define lseek _lseeki64 +#endif /* use struct stat with 64 bit st_size */ #ifdef stat -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/12] MINGW: config.mak.uname: drop USE_NED_ALLOCATOR
nedalloc was initially added in f0ed82 to fix slowness of standard WinXP memory allocator. Since WinXP is EOLed, this point is no longer valid. The actual reason behind this commit is incompatibility of malloc.c.h with MinGW-W64 headers. Alternative solution implies updating nedalloc to something newer. Signed-off-by: Marat Radchenko --- config.mak.uname | 2 -- 1 file changed, 2 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index 4883fd5..3fea7a8 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -342,7 +342,6 @@ ifeq ($(uname_S),Windows) NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease NO_NSEC = YesPlease USE_WIN32_MMAP = YesPlease - # USE_NED_ALLOCATOR = YesPlease UNRELIABLE_FSTAT = UnfortunatelyYes OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo NO_REGEX = YesPlease @@ -492,7 +491,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease NO_NSEC = YesPlease USE_WIN32_MMAP = YesPlease - USE_NED_ALLOCATOR = YesPlease UNRELIABLE_FSTAT = UnfortunatelyYes OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo NO_REGEX = YesPlease -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/12] MINGW: do not fail at redefining pid_t on MinGW-W64
pid_t is available in sys/types.h on both MinGW and MinGW-W64 Signed-off-by: Marat Radchenko --- compat/mingw.h | 1 - compat/msvc.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compat/mingw.h b/compat/mingw.h index c502a22..8850109 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -5,7 +5,6 @@ * things that are not available in header files */ -typedef int pid_t; typedef int uid_t; typedef int socklen_t; #define hstrerror strerror diff --git a/compat/msvc.h b/compat/msvc.h index cb41ce3..e2fda48 100644 --- a/compat/msvc.h +++ b/compat/msvc.h @@ -18,6 +18,8 @@ #define PRIuMAX "I64u" #define PRId64 "I64d" +typedef int pid_t; + static __inline int strcasecmp (const char *s1, const char *s2) { int size1 = strlen(s1); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html