Re: [PATCH v2 6/6] exclude: filter patterns by directory level
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: A non-basename pattern that does not contain /**/ can't match anything outside the attached directory. Record its directory level and avoid matching unless the pathname is also at the same directory level. Without defining what a directory level is, the above is a bit hard to grok, but I think you mean an entry b/c/*.c that appears in a/.gitignore file will want to match a path that is directly in a/b/c directory (and not in its subdirectories), a/b/x.c at the two levels deep subdirectory or a/b/c/d/x.c that is four levels deep will never match the pattern. The logic feels sound. diff --git a/dir.c b/dir.c index 880b5e6..de7a6ba 100644 --- a/dir.c +++ b/dir.c @@ -360,10 +360,12 @@ static int no_wildcard(const char *string) void parse_exclude_pattern(const char **pattern, int *patternlen, int *flags, -int *nowildcardlen) +int *nowildcardlen, +int *dirs_p) { const char *p = *pattern; size_t i, len; + int dirs; *flags = 0; if (*p == '!') { @@ -375,12 +377,15 @@ void parse_exclude_pattern(const char **pattern, len--; *flags |= EXC_FLAG_MUSTBEDIR; } - for (i = 0; i len; i++) { + for (i = 0, dirs = 0; i len; i++) { if (p[i] == '/') - break; + dirs++; } - if (i == len) + if (!dirs) *flags |= EXC_FLAG_NODIR; + else if (*p == '/') + dirs--; I presume this is to compensate for a pattern like /pat whose leading slash is only to anchor the pattern at the level. Correct? @@ -415,11 +423,26 @@ void add_exclude(const char *string, const char *base, x = xmalloc(sizeof(*x)); x-pattern = string; } + /* + * TODO: nowildcardlen patternlen is a stricter than + * necessary mainly to exclude ** that breaks directory + * boundary. Patterns like /foo-* should be fine. + */ + if ((flags EXC_FLAG_NODIR) || nowildcardlen patternlen) + dirs = -1; OK, so an entry README to match README in any subdirectory will becomes (dirs 0) and the matcher below will not short-circuit the comparison. Good. + else { + int i; + for (i = 0; i baselen; i++) { + if (base[i] == '/') + dirs++; + } + } x-patternlen = patternlen; x-nowildcardlen = nowildcardlen; x-base = base; x-baselen = baselen; x-flags = flags; + x-dirs = dirs; x-srcpos = srcpos; ALLOC_GROW(el-excludes, el-nr + 1, el-alloc); el-excludes[el-nr++] = x; @@ -701,7 +724,7 @@ int match_pathname(const char *pathname, int pathlen, * matched, or NULL for undecided. */ static struct exclude *last_exclude_matching_from_list(const char *pathname, -int pathlen, +int pathlen, int dirs, const char *basename, int *dtype, struct exclude_list *el) @@ -732,6 +755,9 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname, continue; } + if (dirs = 0 x-dirs = 0 x-dirs != dirs) + continue; -- 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: inotify to minimize stat() calls
Duy Nguyen wrote: On Fri, Mar 8, 2013 at 3:15 PM, Junio C Hamano gits...@pobox.com wrote: The possible options are: + - - 'no' - Show no untracked files + - 'no' - Show no untracked files (this is fastest) There is a trade-off around the use of -uno between safety and performance. The default is not to use -uno so that you will not forget to add a file you newly created (i.e safety). You would pay for the safety with the cost to find such untracked files (i.e. performance). I suspect that the documentation was written with the assumption that at least for the people who are reading this part of the documentation, the trade-off is obvious. In order to find more information, you naturally need to spend more cycles. If the trade-off is not so obvious, however, I do not object at all to describing it. But if we are to do so, I do object to mentioning only one side of the trade-off. People who choose fastest needs to be made very aware that they are disabling safety. On the topic of trading off, I was thinking about new -uauto as default that is like -uall if it takes less than a certan amount of time (e.g. 0.5 seconds), if it exceeds that limit, the operation is aborted (i.e. it turns to -uno). The safety net is still there, git status advices to use -u to show full information. Ugh, this is too opaque; the user has no idea whether untracked files are being counted or not. Or a less intrusive approach: measure the time and advice the user to (read doc and) use -uno. I just learnt about -uno myself, from this thread. At best, it's a stopgap until we get inotify support. But it's probably worth waiting for the first cut of inotify support from Ram. It's better with inotify anyway. This is quite urgent in my opinion. One of git's primary tasks is to quickly tell me what changed in the repository, and inotify is the perfect way to do this. I'll try to get the first cut out quickly, so we can immediately correct any fundamental design flaws. -- 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
Fwd: mailmap documentation add grave accents
Hi, Here is the patch. Regards, ch3cooli 0001-mailmap-add-grave-accents-around-mailmap.file-and-ma.patch Description: Binary data
Re: pt_BR initializaton
Hi Harring, I'm glad to see that there will be another locale for Git. I reviewed three commit from you. There are some problems: Because git has a strict and high standard for commit log, so 1. your commit log must have Signed-off-by: line(s). Commit using commit -s, or using alias such as git config --global alias.ci 'commit -s' may help. Such line(s) are signatures of reviewers and contributors for your commit, and these line(s) are ordered by the time of contributions. 2. 50+72 rule. The first line of your commit should no longer than 50 characters, and should not contain characters other than standard ascii characters. This is because when your commit save as patch file using git format-patch, first line of your commit will be used as filename, and as email subject. Then a blank line to separate subject and other contents if there are any other descriptions for your commit. Other lines in your commit log messages should be wrapped at line 72 or less, and you can use unicode characters. 3. Add l10n: prefix in subject of your commit log messages. You can find out how other l10n contributors writing there commit log message, using this command: git log -- po/ 4. Squash trivial commits before send to upstream. If you find it is hard to write your commit log message, it may indicate that you have make too many trivial commits. In this case, you should squash your commit before send them to upstream using git rebase -i --autosquash command. Tips: trivial commit (for backup or fixup previous commit) may commit using --fixup or --squash option, such as: git commit --fixup HEAD and these commits will be squash automatically when: git rebase -i --autosquash There is a script in po-helper branch, and I use it to check commits from other l10n contributors, and it may also help for you: https://github.com/git-l10n/git-po/blob/po-helper/po/po-helper.sh This discussion may also help: http://article.gmane.org/gmane.comp.version-control.git/198626 2013/3/10 Harring Figueiredo harri...@gmail.com: Hello Jiang, Please pull the changes from https://github.com/harringf/git-po.git to initialize the pt_BR translation. Thank you, Harring Figueiredo -- Jiang Xin -- 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 v2 6/6] exclude: filter patterns by directory level
On Sun, Mar 10, 2013 at 3:20 PM, Junio C Hamano gits...@pobox.com wrote: + else if (*p == '/') + dirs--; I presume this is to compensate for a pattern like /pat whose leading slash is only to anchor the pattern at the level. Correct? Yes. Also for the record, we could cut down the number of prep_exclude calls significantly by only calling it when we switch directories (i.e. when read_directory_recursive begins or exits), not calling it for all entries of the same directory. For instance, path/, path/a, path/b, path/c/, path/c/d, path/e should only call prep_exclude 3 times when we enter path, path/c and leave path/c (rather than 6 times currently). Unfortunately, I see no real time savings by this call reduction. So no patch. Maybe I'll try it again on my slower laptop and see if it makes any difference. -- Duy -- 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 v2 3/6] match_basename: use strncmp instead of strcmp
On Sun, Mar 10, 2013 at 2:34 PM, Junio C Hamano gits...@pobox.com wrote: Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: strncmp is provided length information which could be taken advantage by the underlying implementation. I may be missing something fundamental, but I somehow find the above does not make any sense. strcmp(a, b) has to pay attention to NUL in these strings and stop comparison. strncmp(a, b, n) not only has to pay the same attention to NUL in the strings, but also needs to stop comparing at n bytes. In what situation can the latter take advantage of that extra thing that it needs to keep track of and operate faster, when n is the length of shorter of the two strings? glibc's C strncmp version does 4-byte comparison at a time when n =4, then fall back to 1-byte for the rest. I don't know if it's faster than a plain always 1-byte comparison though. There's also the hand written assembly version that compares n from 1..16, not exactly sure how this version works yet. diff --git a/dir.c b/dir.c index 9960a37..46b24db 100644 --- a/dir.c +++ b/dir.c @@ -610,12 +610,14 @@ int match_basename(const char *basename, int basenamelen, int flags) { if (prefix == patternlen) { - if (!strcmp_icase(pattern, basename)) + if (patternlen == basenamelen + !strncmp_icase(pattern, basename, patternlen)) return 1; What happens if you replace this with if (patternlen == baselen !strcmp_icase(pattern, basename, patternlen)) and drop the other hunk and run the benchmark again? before after user0m0.533s0m0.522s user0m0.549s0m0.530s user0m0.550s0m0.534s user0m0.551s0m0.545s user0m0.556s0m0.550s user0m0.557s0m0.552s user0m0.559s0m0.554s user0m0.564s0m0.561s user0m0.567s0m0.565s user0m0.567s0m0.565s -- Duy -- 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 2/2] shell: new no-interactive-login command to print a custom message
Jonathan Nieder wrote: * If the file ~/git-shell-commands/no-interactive-login exists, run no-interactive-login to let the server say what it likes, then hang up. * Otherwise, if ~/git-shell-commands/ is present, start an interactive read-eval-print loop. * Otherwise, print the usual configuration hint and hang up. Excellent. A way to suppress the ugly warning, and replace it with a nice message in a non-interactive shell. You've chosen no-interactive-login as the name of this special file, which is reasonable. I'm not too fond of the name git-shell-commands in the first place, but I suspect it's too late to do anything about it now. diff --git a/shell.c b/shell.c index 84b237fe..1429870a 100644 --- a/shell.c +++ b/shell.c @@ -6,6 +6,7 @@ #define COMMAND_DIR git-shell-commands #define HELP_COMMAND COMMAND_DIR /help +#define NOLOGIN_COMMAND COMMAND_DIR /no-interactive-login static int do_generic_cmd(const char *me, char *arg) { @@ -65,6 +66,18 @@ static void run_shell(void) { int done = 0; static const char *help_argv[] = { HELP_COMMAND, NULL }; + + if (!access(NOLOGIN_COMMAND, F_OK)) { + /* Interactive login disabled. */ You're just checking for its existence here, not for execute permissions. + const char *argv[] = { NOLOGIN_COMMAND, NULL }; + int status; + + status = run_command_v_opt(argv, 0); If no-interactive-login doesn't have execute permissions, we'll get an error from here: fatal: cannot exec 'git-shell-commands/no-interactive-login': Permission denied Would you like to check that the file has execute permission in advance to prevent some extra processing (in run_command_v_opt, start_command and friends) before this message is printed? Looks good otherwise. -- 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: Memory corruption when rebasing with git version 1.8.1.5 on arch
On 03/10/2013 08:05 AM, Jeff King wrote: On Sat, Mar 09, 2013 at 11:54:36AM +0100, Bernhard Posselt wrote: Also, I can almost reproduce here, as PatrickHeller/core.git is public. However, I suspect the problem is particular to your work built on top, which looks like it is at commit 0525bbd73c9015499ba92d1ac654b980aaca35b2. Is it possible for you to make that commit available on a temporary branch? What do you mean exactly by that? I just meant to push the work from your local repository somewhere where I could access it to try to replicate the issue. What you did here: git clone https://github.com/Raydiation/memorycorruption cd memorycorruption git pull --rebase https://github.com/Raydiation/core ...should be plenty. Unfortunately, I'm not able to reproduce the segfault. All of the patches apply fine, both normally and when run under valgrind. Heres the output of the GIT_TRACE file [...] trace: built-in: git 'apply' '--index' '/srv/http/owncloud/.git/rebase-apply/patch' This confirms my suspicion that the problem is in git apply. You had mentioned before that the valgrind log was very long. If you're still able to reproduce, could you try running it with valgrind like this: valgrind -q --trace-children=yes --log-file=/tmp/valgrind.out \ git pull --rebase https://github.com/Raydiation/core Logging to a file instead of stderr should mean we still get output for commands that are invoked with their stderr redirected (which is the case for the git apply in question), and using -q should eliminate the uninteresting cruft from the log. -Peff Do you need debug symbols? ==2395== Invalid write of size 1 ==2395==at 0x4C2DB93: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2395==by 0x4076B1: ??? (in /usr/lib/git-core/git) ==2395==by 0x40A60F: ??? (in /usr/lib/git-core/git) ==2395==by 0x40C29F: ??? (in /usr/lib/git-core/git) ==2395==by 0x40CC35: ??? (in /usr/lib/git-core/git) ==2395==by 0x40F584: ??? (in /usr/lib/git-core/git) ==2395==by 0x4058E7: ??? (in /usr/lib/git-core/git) ==2395==by 0x404DD1: ??? (in /usr/lib/git-core/git) ==2395==by 0x58F3A14: (below main) (in /usr/lib/libc-2.17.so) ==2395== Address 0x5f245c0 is 0 bytes after a block of size 384 alloc'd ==2395==at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2395==by 0x4C2C2FF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2395==by 0x4F057B: ??? (in /usr/lib/git-core/git) ==2395==by 0x4DDF9F: ??? (in /usr/lib/git-core/git) ==2395==by 0x409E9C: ??? (in /usr/lib/git-core/git) ==2395==by 0x40C29F: ??? (in /usr/lib/git-core/git) ==2395==by 0x40CC35: ??? (in /usr/lib/git-core/git) ==2395==by 0x40F584: ??? (in /usr/lib/git-core/git) ==2395==by 0x4058E7: ??? (in /usr/lib/git-core/git) ==2395==by 0x404DD1: ??? (in /usr/lib/git-core/git) ==2395==by 0x58F3A14: (below main) (in /usr/lib/libc-2.17.so) ==2395== ==2395== Invalid read of size 1 ==2395==at 0x4C2DCB4: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2395==by 0x40B0D5: ??? (in /usr/lib/git-core/git) ==2395==by 0x40C29F: ??? (in /usr/lib/git-core/git) ==2395==by 0x40CC35: ??? (in /usr/lib/git-core/git) ==2395==by 0x40F584: ??? (in /usr/lib/git-core/git) ==2395==by 0x4058E7: ??? (in /usr/lib/git-core/git) ==2395==by 0x404DD1: ??? (in /usr/lib/git-core/git) ==2395==by 0x58F3A14: (below main) (in /usr/lib/libc-2.17.so) ==2395== Address 0x5f245e1 is not stack'd, malloc'd or (recently) free'd ==2395== -- 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 v2 6/6] exclude: filter patterns by directory level
On Sun, Mar 10, 2013 at 5:58 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: A non-basename pattern that does not contain /**/ can't match anything outside the attached directory. Record its directory level and avoid matching unless the pathname is also at the same directory level. Without defining what a directory level is, the above is a bit hard to grok, but I think you mean an entry b/c/*.c that appears in a/.gitignore file will want to match a path that is directly in a/b/c directory (and not in its subdirectories), a/b/x.c at the two levels deep subdirectory or a/b/c/d/x.c that is four levels deep will never match the pattern. The logic feels sound. Actually, I think you may be able to do a lot more with a simpler change. If your top-level .gitignore has a/b/c/*.c in it, you certainly want to mark it not to be applied when you are looking at paths directly in directory a/b/ because they will never match, but you also know that nothing will match when you are inside a/b/d/, even though the pattern and the path you are checking are at the same levels. Your dirlen approach will fail for that case, no? The idea behind prep_exclude() that organizes the exclode patterns into a stack structure and update the groups near the leaves by popping those for the old directory we were in and pushing those for the new directory we are going into is to give us a place to tweak the elements on the whole stack for optimization when we notice that we are looking at paths in different directories. Instead of giving a dirlen member to each element, you could give a do not look at me flag to it, and when you notice that you were in a/b/c/ and now you are going to look at paths in a/b/d/, you can look at the group that was read from the .gitignore from the top-level, and mark entries that cannot be relevant (e.g. a/b/c/*.c) as such. The mark does not have to be a boolean. a/b/*.c when you are in a/b/c/ can be marked as This never matches, and I do not have to re-check until I pop one level. When digging deeper to a/b/c/d, you add one to that. When switching to a/b/e, you would first pop twice (d and then c), each time decrementing the I do not have to re-check counter by one, and then when pushing e down, you notice that you need to re-check, and mark it again as no need to re-check for one pop. So it is not like you have to re-scan all entries textually every time you switch directories. Most entries that are level-limited you would increment or decrement its counter and only the ones at the level boundary need to be re-checked. A bit confused by dirlen (what is it?). I think what you're trying to say is mark whether a pattern is applicable for entries in this directory in prep_exclude, update the marks as we push and pop directories. It does not sound simpler (and it's actually more powerful, as you said it could avoid checking a/b/c/*.c when standing in a/b/d). I'll give it a try. -- Duy -- 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 v2 3/6] match_basename: use strncmp instead of strcmp
On Sun, Mar 10, 2013 at 11:38 AM, Duy Nguyen pclo...@gmail.com wrote: glibc's C strncmp version does 4-byte comparison at a time when n =4, then fall back to 1-byte for the rest. Looking at this (http://fossies.org/dox/glibc-2.17/strncmp_8c_source.html), it's not exactly true. It would rather be while (n = 4), manually unroll the loop. -- 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: Memory corruption when rebasing with git version 1.8.1.5 on arch
On 03/10/2013 08:05 AM, Jeff King wrote: On Sat, Mar 09, 2013 at 11:54:36AM +0100, Bernhard Posselt wrote: Also, I can almost reproduce here, as PatrickHeller/core.git is public. However, I suspect the problem is particular to your work built on top, which looks like it is at commit 0525bbd73c9015499ba92d1ac654b980aaca35b2. Is it possible for you to make that commit available on a temporary branch? What do you mean exactly by that? I just meant to push the work from your local repository somewhere where I could access it to try to replicate the issue. What you did here: git clone https://github.com/Raydiation/memorycorruption cd memorycorruption git pull --rebase https://github.com/Raydiation/core ...should be plenty. Unfortunately, I'm not able to reproduce the segfault. All of the patches apply fine, both normally and when run under valgrind. Heres the output of the GIT_TRACE file [...] trace: built-in: git 'apply' '--index' '/srv/http/owncloud/.git/rebase-apply/patch' This confirms my suspicion that the problem is in git apply. You had mentioned before that the valgrind log was very long. If you're still able to reproduce, could you try running it with valgrind like this: valgrind -q --trace-children=yes --log-file=/tmp/valgrind.out \ git pull --rebase https://github.com/Raydiation/core Logging to a file instead of stderr should mean we still get output for commands that are invoked with their stderr redirected (which is the case for the git apply in question), and using -q should eliminate the uninteresting cruft from the log. -Peff First time I've used Archlinux ABS and build from source :) The log file was empty and it seemed to apply everything nice when running valgrind. When i tried to run it without valgrind it failed with memory corruption. Heres the output with debug symbols, fetched with tail -f: ==22291== Invalid write of size 1 ==22291==at 0x4C2DB93: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==22291==by 0x4076B1: update_pre_post_images (in /usr/lib/git-core/git) ==22291==by 0x40A60F: apply_fragments (in /usr/lib/git-core/git) ==22291==by 0x40C29F: check_patch_list (in /usr/lib/git-core/git) ==22291==by 0x40CC35: apply_patch (in /usr/lib/git-core/git) ==22291==by 0x40F584: cmd_apply (in /usr/lib/git-core/git) ==22291==by 0x4058E7: handle_internal_command (in /usr/lib/git-core/git) ==22291==by 0x404DD1: main (in /usr/lib/git-core/git) ==22291== Address 0x5f245c0 is 0 bytes after a block of size 384 alloc'd ==22291==at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==22291==by 0x4C2C2FF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==22291==by 0x4F057B: xrealloc (in /usr/lib/git-core/git) ==22291==by 0x4DDF9F: strbuf_grow (in /usr/lib/git-core/git) ==22291==by 0x409E9C: apply_fragments (in /usr/lib/git-core/git) ==22291==by 0x40C29F: check_patch_list (in /usr/lib/git-core/git) ==22291==by 0x40CC35: apply_patch (in /usr/lib/git-core/git) ==22291==by 0x40F584: cmd_apply (in /usr/lib/git-core/git) ==22291==by 0x4058E7: handle_internal_command (in /usr/lib/git-core/git) ==22291==by 0x404DD1: main (in /usr/lib/git-core/git) ==22291== ==22291== Invalid read of size 1 ==22291==at 0x4C2DCB4: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==22291==by 0x40B0D5: apply_fragments (in /usr/lib/git-core/git) ==22291==by 0x40C29F: check_patch_list (in /usr/lib/git-core/git) ==22291==by 0x40CC35: apply_patch (in /usr/lib/git-core/git) ==22291==by 0x40F584: cmd_apply (in /usr/lib/git-core/git) ==22291==by 0x4058E7: handle_internal_command (in /usr/lib/git-core/git) ==22291==by 0x404DD1: main (in /usr/lib/git-core/git) ==22291== Address 0x5f245e1 is not stack'd, malloc'd or (recently) free'd ==22291== -- 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 v2 3/6] match_basename: use strncmp instead of strcmp
On Sun, Mar 10, 2013 at 12:43 PM, Antoine Pelisse apeli...@gmail.com wrote: On Sun, Mar 10, 2013 at 11:38 AM, Duy Nguyen pclo...@gmail.com wrote: glibc's C strncmp version does 4-byte comparison at a time when n =4, then fall back to 1-byte for the rest. Looking at this (http://fossies.org/dox/glibc-2.17/strncmp_8c_source.html), it's not exactly true. It would rather be while (n = 4), manually unroll the loop. By the way, if we know the length of the string, we could use memcmp. This one is allowed to compare 4-bytes at a time (he doesn't care about end of string). This is true because the value of the length parameter is no longer at most. -- 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 v2 3/6] match_basename: use strncmp instead of strcmp
On Sun, Mar 10, 2013 at 6:54 PM, Antoine Pelisse apeli...@gmail.com wrote: On Sun, Mar 10, 2013 at 12:43 PM, Antoine Pelisse apeli...@gmail.com wrote: On Sun, Mar 10, 2013 at 11:38 AM, Duy Nguyen pclo...@gmail.com wrote: glibc's C strncmp version does 4-byte comparison at a time when n =4, then fall back to 1-byte for the rest. Looking at this (http://fossies.org/dox/glibc-2.17/strncmp_8c_source.html), it's not exactly true. It would rather be while (n = 4), manually unroll the loop. By the way, if we know the length of the string, we could use memcmp. This one is allowed to compare 4-bytes at a time (he doesn't care about end of string). This is true because the value of the length parameter is no longer at most. We still need to worry about access violation after NUL when two strings have different lengths. That could be avoided in this particular case, but I think it's too fragile. -- Duy -- 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 v2 3/6] match_basename: use strncmp instead of strcmp
By the way, if we know the length of the string, we could use memcmp. This one is allowed to compare 4-bytes at a time (he doesn't care about end of string). This is true because the value of the length parameter is no longer at most. We still need to worry about access violation after NUL when two strings have different lengths. That could be avoided in this particular case, but I think it's too fragile. Why would we need to compare if the strings don't have the same length ? We already do that in combine-diff.c:append_lost(). -- 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 v2 3/6] match_basename: use strncmp instead of strcmp
On Sun, Mar 10, 2013 at 7:11 PM, Antoine Pelisse apeli...@gmail.com wrote: By the way, if we know the length of the string, we could use memcmp. This one is allowed to compare 4-bytes at a time (he doesn't care about end of string). This is true because the value of the length parameter is no longer at most. We still need to worry about access violation after NUL when two strings have different lengths. That could be avoided in this particular case, but I think it's too fragile. Why would we need to compare if the strings don't have the same length ? We already do that in combine-diff.c:append_lost(). Watching movie and replying to git@ don't mix. You're right we don't need to compare if lengths are different. What was I thinking.. -- Duy -- 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: rebase: strange failures to apply patc 3-way
Sorry for taking so long to reply... :-/ On 09.03.2013, at 19:32, Andrew Wong wrote: On 03/09/13 06:26, Max Horn wrote: It tends to fail in separate places, but eventually stabilizes. E.g. I just did a couple test rebases, and it failed twice in commit 14, then the third time in commit 15 (which underlines once more that the failures are inappropriate). The fourth time, something new and weird happened: $ git rebase --abort $ git rebase NEW-PARENT Cannot rebase: You have unstaged changes. Please commit or stash them. $ This is quite suspicious. It appears that git for some reason things a file is dirty when it isn't. That could explain the other rebase failures too, couldn't it? But what might cause such a thing? Yea, that's really suspicious. This could mean there's an issue with when git is checking the index. Try running these a couple times in a clean work tree: $ git update-index --refresh $ git diff-files In a clean work tree, these commands should print nothing. But in your case, these might print random files that git thinks have been modified... I did run touch lib/*.* src/*.* git update-index --refresh git diff-files a couple dozen times (the problematic files where in src/ and lib), but nothing happened. I just re-checked, and the rebase still fails in the same why... Perhaps I should add some printfs into the git source to figure out what exactly it thinks is not right about those files... i.e. how does it come to the conclusion that I have local changes, exactly. I don't know how Git does that -- does it take the mtime from (l)stat into account? Perhaps problems with my machine's clock could be responsible? If the commands do print out some files, check the timestamp from the git index and the filesystem: $ git ls-files --debug file1 file2 $ stat -f %N %m %c file1 file2 Is this repo on a network drive? Or is it local drive in your Mac? Local (some more details also described in my first email on this thread, but I'll happily provide more data if I can). Thanks again, Max-- 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] Translate git_more_info_string consistently
git help translated the See 'git help command' for more information... message, but git didn't. Signed-off-by: Kevin Bracey ke...@bracey.fi --- git.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git.c b/git.c index d33f9b3..e484644 100644 --- a/git.c +++ b/git.c @@ -536,7 +536,7 @@ int main(int argc, const char **argv) commit_pager_choice(); printf(usage: %s\n\n, git_usage_string); list_common_cmds_help(); - printf(\n%s\n, git_more_info_string); + printf(\n%s\n, _(git_more_info_string)); exit(1); } cmd = argv[0]; -- 1.8.2.rc3.8.g96befb6.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
Re: [PATCH 1/2] require pathspec for git add -u/-A
Junio C Hamano gits...@pobox.com writes: As promised in 0fa2eb530fb7 (add: warn when -u or -A is used without pathspec, 2013-01-28), git add -u/-A that is run without pathspec in a subdirectory will stop working sometime before Git 2.0, to wean users off of the old default, in preparation for adopting the new default in Git 2.0. I originally thought this step was necessary, but I changed my mind. The warning is big enough and doesn't need to be turned into an error. If this step is applied, it should be applied at 2.0, not before, as this is the big incompatible change. Re-introducing a new behavior won't harm users OTOH. -- 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: [PATCH 4/4] teach config parsing to read from strbuf
Hi, On Thu, Mar 07, 2013 at 06:42:43PM +, Ramsay Jones wrote: Heiko Voigt wrote: +int git_config_from_strbuf(config_fn_t fn, struct strbuf *strbuf, void *data) +{ + struct config top; + struct config_strbuf str; + + str.strbuf = strbuf; + str.pos = 0; + + top.data = str; You will definitely want to initialise 'top.name' here, rather than let it take whatever value happens to be at that position on the stack. In your editor, search for 'cf-name' and contemplate each such occurrence. Good catch, thanks. The initialization seems to got lost during refactoring. In the codepaths we call with the new strbuf function it is only used for error reporting so I think we need to get the name from the user of this function so the error messages are useful. I have extended the test to demonstrate how I imagine this name could look like. Does the 'include' facility work from a strbuf? Should it? No the 'include' facility does not work here. A special handling would need to be implemented by the caller. For us 'include' values have no special meaning and are parsed like normal values. AFAICS when a config file is given to git config we do not currently respect includes. So we can just do the same behavior here for the moment. There is no roadblock against adding it later. Are you happy with the error handling/reporting? Good point, while adding the name for strbuf I noticed that we currently die on some parsing errors. We should probably make these errors handleable for strbufs. Currently the main usecase is to read submodule configurations from the database and in case someone commits a broken configuration we should be able to continue with that. Otherwise the repository might render into an unuseable state. I will look into that. Do the above additions to the test-suite give you confidence that the code works as you intend? Well, I am reusing most of the existing infrastructure which I assume is tested using config files. So what I want to test here is the integration of this new function. As you mentioned the name variable I have now added a test for the parsing error case as well. I have refactored the test binary to read configs from stdin so its easiert to implement further tests from the bash part of the testsuite. I will send out another iteration shortly. Cheers Heiko -- 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 v2 0/4] allow more sources for config values
The following issues still exist: * Error handling: If this should be useful to interrogate configs from the database during git operations we need a way to recover from parsing errors instead of dying. * More tests ? This is an update with the comments of the first iteration[1] incorporated. [1] http://thread.gmane.org/gmane.comp.version-control.git/217018/ Heiko Voigt (4): config: factor out config file stack management config: drop file pointer validity check in get_next_char() config: make parsing stack struct independent from actual data source teach config parsing to read from strbuf .gitignore | 1 + Makefile | 1 + cache.h| 2 + config.c | 143 ++--- t/t1300-repo-config.sh | 24 + test-config.c | 40 ++ 6 files changed, 180 insertions(+), 31 deletions(-) create mode 100644 test-config.c -- 1.8.2.rc0.26.gf7384c5 -- 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 v2 1/4] config: factor out config file stack management
Because a config callback may start parsing a new file, the global context regarding the current config file is stored as a stack. Currently we only need to manage that stack from git_config_from_file. Let's factor it out to allow new sources of config data. Signed-off-by: Heiko Voigt hvo...@hvoigt.net --- config.c | 38 -- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/config.c b/config.c index aefd80b..2c299dc 100644 --- a/config.c +++ b/config.c @@ -896,6 +896,28 @@ int git_default_config(const char *var, const char *value, void *dummy) return 0; } +static int do_config_from(struct config_file *top, config_fn_t fn, void *data) +{ + int ret; + + /* push config-file parsing state stack */ + top-prev = cf; + top-linenr = 1; + top-eof = 0; + strbuf_init(top-value, 1024); + strbuf_init(top-var, 1024); + cf = top; + + ret = git_parse_file(fn, data); + + /* pop config-file parsing state stack */ + strbuf_release(top-value); + strbuf_release(top-var); + cf = top-prev; + + return ret; +} + int git_config_from_file(config_fn_t fn, const char *filename, void *data) { int ret; @@ -905,22 +927,10 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data) if (f) { config_file top; - /* push config-file parsing state stack */ - top.prev = cf; top.f = f; top.name = filename; - top.linenr = 1; - top.eof = 0; - strbuf_init(top.value, 1024); - strbuf_init(top.var, 1024); - cf = top; - - ret = git_parse_file(fn, data); - - /* pop config-file parsing state stack */ - strbuf_release(top.value); - strbuf_release(top.var); - cf = top.prev; + + ret = do_config_from(top, fn, data); fclose(f); } -- 1.8.2.rc0.26.gf7384c5 -- 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 v2 2/4] config: drop file pointer validity check in get_next_char()
The only location where cf is set in this file is in do_config_from(). This function has only one callsite which is config_from_file(). In config_from_file() its ensured that the f member is set to non-zero. Signed-off-by: Heiko Voigt hvo...@hvoigt.net --- config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index 2c299dc..f55c43d 100644 --- a/config.c +++ b/config.c @@ -169,10 +169,10 @@ int git_config_from_parameters(config_fn_t fn, void *data) static int get_next_char(void) { int c; - FILE *f; c = '\n'; - if (cf ((f = cf-f) != NULL)) { + if (cf) { + FILE *f = cf-f; c = fgetc(f); if (c == '\r') { /* DOS like systems */ -- 1.8.2.rc0.26.gf7384c5 -- 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 v2 3/4] config: make parsing stack struct independent from actual data source
To simplify adding other sources we extract all functions needed for parsing into a list of callbacks. We implement those callbacks for the current file parsing. A new source can implement its own set of callbacks. Instead of storing the concrete FILE pointer for parsing we store a void pointer. A new source can use this to store its custom data. Signed-off-by: Heiko Voigt hvo...@hvoigt.net --- config.c | 63 +++ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/config.c b/config.c index f55c43d..fe1c0e5 100644 --- a/config.c +++ b/config.c @@ -10,20 +10,42 @@ #include strbuf.h #include quote.h -typedef struct config_file { - struct config_file *prev; - FILE *f; +struct config_source { + struct config_source *prev; + void *data; const char *name; int linenr; int eof; struct strbuf value; struct strbuf var; -} config_file; -static config_file *cf; + int (*fgetc)(struct config_source *c); + int (*ungetc)(int c, struct config_source *conf); + long (*ftell)(struct config_source *c); +}; + +static struct config_source *cf; static int zlib_compression_seen; +static int config_file_fgetc(struct config_source *conf) +{ + FILE *f = conf-data; + return fgetc(f); +} + +static int config_file_ungetc(int c, struct config_source *conf) +{ + FILE *f = conf-data; + return ungetc(c, f); +} + +static long config_file_ftell(struct config_source *conf) +{ + FILE *f = conf-data; + return ftell(f); +} + #define MAX_INCLUDE_DEPTH 10 static const char include_depth_advice[] = exceeded maximum include depth (%d) while including\n @@ -172,13 +194,12 @@ static int get_next_char(void) c = '\n'; if (cf) { - FILE *f = cf-f; - c = fgetc(f); + c = cf-fgetc(cf); if (c == '\r') { /* DOS like systems */ - c = fgetc(f); + c = cf-fgetc(cf); if (c != '\n') { - ungetc(c, f); + cf-ungetc(c, cf); c = '\r'; } } @@ -339,7 +360,7 @@ static int get_base_var(struct strbuf *name) } } -static int git_parse_file(config_fn_t fn, void *data) +static int git_parse_source(config_fn_t fn, void *data) { int comment = 0; int baselen = 0; @@ -896,7 +917,7 @@ int git_default_config(const char *var, const char *value, void *dummy) return 0; } -static int do_config_from(struct config_file *top, config_fn_t fn, void *data) +static int do_config_from_source(struct config_source *top, config_fn_t fn, void *data) { int ret; @@ -908,7 +929,7 @@ static int do_config_from(struct config_file *top, config_fn_t fn, void *data) strbuf_init(top-var, 1024); cf = top; - ret = git_parse_file(fn, data); + ret = git_parse_source(fn, data); /* pop config-file parsing state stack */ strbuf_release(top-value); @@ -925,12 +946,15 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data) ret = -1; if (f) { - config_file top; + struct config_source top; - top.f = f; + top.data = f; top.name = filename; + top.fgetc = config_file_fgetc; + top.ungetc = config_file_ungetc; + top.ftell = config_file_ftell; - ret = do_config_from(top, fn, data); + ret = do_config_from_source(top, fn, data); fclose(f); } @@ -1063,7 +1087,6 @@ static int store_aux(const char *key, const char *value, void *cb) { const char *ep; size_t section_len; - FILE *f = cf-f; switch (store.state) { case KEY_SEEN: @@ -1075,7 +1098,7 @@ static int store_aux(const char *key, const char *value, void *cb) return 1; } - store.offset[store.seen] = ftell(f); + store.offset[store.seen] = cf-ftell(cf); store.seen++; } break; @@ -1102,19 +1125,19 @@ static int store_aux(const char *key, const char *value, void *cb) * Do not increment matches: this is no match, but we * just made sure we are in the desired section. */ - store.offset[store.seen] = ftell(f); + store.offset[store.seen] = cf-ftell(cf); /* fallthru */ case SECTION_END_SEEN: case START: if (matches(key, value)) { - store.offset[store.seen] = ftell(f); + store.offset[store.seen] = cf-ftell(cf);
[PATCH v2 4/4] teach config parsing to read from strbuf
This can be used to read configuration values directly from gits database. Signed-off-by: Heiko Voigt hvo...@hvoigt.net --- .gitignore | 1 + Makefile | 1 + cache.h| 2 ++ config.c | 48 t/t1300-repo-config.sh | 24 test-config.c | 40 6 files changed, 116 insertions(+) create mode 100644 test-config.c diff --git a/.gitignore b/.gitignore index 6669bf0..386b7f2 100644 --- a/.gitignore +++ b/.gitignore @@ -178,6 +178,7 @@ /gitweb/static/gitweb.min.* /test-chmtime /test-ctype +/test-config /test-date /test-delta /test-dump-cache-tree diff --git a/Makefile b/Makefile index 26d3332..1a9ea10 100644 --- a/Makefile +++ b/Makefile @@ -541,6 +541,7 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS)) TEST_PROGRAMS_NEED_X += test-chmtime TEST_PROGRAMS_NEED_X += test-ctype +TEST_PROGRAMS_NEED_X += test-config TEST_PROGRAMS_NEED_X += test-date TEST_PROGRAMS_NEED_X += test-delta TEST_PROGRAMS_NEED_X += test-dump-cache-tree diff --git a/cache.h b/cache.h index e493563..a2621fa 100644 --- a/cache.h +++ b/cache.h @@ -1128,6 +1128,8 @@ extern int update_server_info(int); typedef int (*config_fn_t)(const char *, const char *, void *); extern int git_default_config(const char *, const char *, void *); extern int git_config_from_file(config_fn_t fn, const char *, void *); +extern int git_config_from_strbuf(config_fn_t fn, const char *name, + struct strbuf *strbuf, void *data); extern void git_config_push_parameter(const char *text); extern int git_config_from_parameters(config_fn_t fn, void *data); extern int git_config(config_fn_t fn, void *); diff --git a/config.c b/config.c index fe1c0e5..b8c8640 100644 --- a/config.c +++ b/config.c @@ -46,6 +46,37 @@ static long config_file_ftell(struct config_source *conf) return ftell(f); } +struct config_strbuf { + struct strbuf *strbuf; + int pos; +}; + +static int config_strbuf_fgetc(struct config_source *conf) +{ + struct config_strbuf *str = conf-data; + + if (str-pos str-strbuf-len) + return str-strbuf-buf[str-pos++]; + + return EOF; +} + +static int config_strbuf_ungetc(int c, struct config_source *conf) +{ + struct config_strbuf *str = conf-data; + + if (str-pos 0) + return str-strbuf-buf[--str-pos]; + + return EOF; +} + +static long config_strbuf_ftell(struct config_source *conf) +{ + struct config_strbuf *str = conf-data; + return str-pos; +} + #define MAX_INCLUDE_DEPTH 10 static const char include_depth_advice[] = exceeded maximum include depth (%d) while including\n @@ -961,6 +992,23 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data) return ret; } +int git_config_from_strbuf(config_fn_t fn, const char *name, struct strbuf *strbuf, void *data) +{ + struct config_source top; + struct config_strbuf str; + + str.strbuf = strbuf; + str.pos = 0; + + top.data = str; + top.name = name; + top.fgetc = config_strbuf_fgetc; + top.ungetc = config_strbuf_ungetc; + top.ftell = config_strbuf_ftell; + + return do_config_from_source(top, fn, data); +} + const char *git_etc_gitconfig(void) { static const char *system_wide; diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 3c96fda..5103f66 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -1087,4 +1087,28 @@ test_expect_success 'barf on incomplete string' ' grep line 3 error ' +test_expect_success 'reading config from strbuf' ' + cat expect -\EOF + var: some.value, value: content + EOF + test-config strbuf 12345:.gitmodules actual -\EOF + [some] + value = content + EOF + test_cmp expect actual +' + +test_expect_success 'reading config from strbuf with error' ' + touch expect.out + cat expect.err -\EOF + fatal: bad config file line 2 in 12345:.gitmodules + EOF + test_must_fail test-config strbuf 12345:.gitmodules actual.out 2actual.err -\EOF + [some] + value = + EOF + test_cmp expect.out actual.out + test_cmp expect.err actual.err +' + test_done diff --git a/test-config.c b/test-config.c new file mode 100644 index 000..c650837 --- /dev/null +++ b/test-config.c @@ -0,0 +1,40 @@ +#include cache.h + +static int config_strbuf(const char *var, const char *value, void *data) +{ + printf(var: %s, value: %s\n, var, value); + + return 1; +} + +static void die_usage(int argc, char **argv) +{ + fprintf(stderr, Usage: %s strbuf name\n, argv[0]); + exit(1); +} + +int main(int argc, char **argv) +{ + if (argc 3) + die_usage(argc, argv); + + if (!strcmp(argv[1], strbuf)) { +
Re: Merging submodules - best merge-base
On Sat, Mar 09, 2013 at 06:45:56PM +0100, Jens Lehmann wrote: Am 07.03.2013 19:59, schrieb Heiko Voigt: On Thu, Mar 07, 2013 at 10:49:09AM +0100, Daniel Bratell wrote: Den 2013-03-06 19:12:05 skrev Heiko Voigt hvo...@hvoigt.net: So to summarize what you are requesting: You want a submodule merge be two way in the view of the superproject and calculate the merge base in the submodule from the two commits that are going to be merged? It currently sounds logical but I have to think about it further and whether that might break other use cases. Maybe both could be legal even. The current code can't be all wrong, and this case also seems to be straightforward. Ok I have thought about it further and I did not come up with a simple (and stable) enough strategy that would allow your use case to merge cleanly without user interaction. The problem is that your are actually doing a rewind from base to both tips. The fact that a rewind is there makes git suspicious and we simply give up. IMO, thats the right thing to do in such a situation. What should a merge strategy do? It infers from two changes what the final intention might be. For submodules we can do that when the changes on both sides point forward. Since thats the typical progress of development. If not there is some reason for it we do not know about. So the merge gives up. Please see this post about why we need to forbid rewinds from the initial design discussion: http://article.gmane.org/gmane.comp.version-control.git/149003 I agree that rewinds are a very good reason not merge two branches using a fast-forward strategy, but I believe Daniel's use case is a (and maybe the only) valid exception to that rule: both branches contain *exactly* the same rewind. In that case I don't see any problem to just do a fast forward to S21, as both agree on the commits to rewind. That is different than using the merge base of the two commits needing merge. I agree that rewinding to exactly the same commits is probably a valid exception. Will have a look into extending the submodule merge strategy to include this case. Cheers Heiko -- 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
[RFC/PATCH] Documentation/technical/api-fswatch.txt: start with outline
git operations are slow on repositories with lots of files, and lots of tiny filesystem calls like lstat(), getdents(), open() are reposible for this. On the linux-2.6 repository, for instance, the numbers for git status look like this: top syscalls sorted top syscalls sorted by acc. timeby number -- 0.401906 40950 lstat0.401906 40950 lstat 0.190484 5343 getdents 0.150055 5374 open 0.150055 5374 open 0.190484 5343 getdents 0.074843 2806 close 0.074843 2806 close 0.003216 157 read 0.003216 157 read To solve this problem, we propose to build a daemon which will watch the filesystem using inotify and report batched up events over a UNIX socket. Since inotify is Linux-only, we have to leave open the possibility of writing similar daemons for other platforms. Everything will continue to work as before if there is no helper present. The fswatch API introduces a generic way for git.git to request for filesystem changes. Different helpers (like the inotify daemon on Linux) will be plugged into this API on different platforms. It falls back to using the filesystem calls. The daemon will start up with the very first operation done on the git repository, and will die after a specified period of repository inactivity. It is going to be a per-repo daemon and will write to a socket in the repository: access control is managed by filesystem permissions. This design is inspired by the credential helper design. Signed-off-by: Ramkumar Ramachandra artag...@gmail.com --- Documentation/technical/api-fswatch.txt | 62 + 1 file changed, 62 insertions(+) create mode 100644 Documentation/technical/api-fswatch.txt diff --git a/Documentation/technical/api-fswatch.txt b/Documentation/technical/api-fswatch.txt new file mode 100644 index 000..9c6826a --- /dev/null +++ b/Documentation/technical/api-fswatch.txt @@ -0,0 +1,62 @@ +fswatch API +=== + +The fswatch API provides an abstracted way of collecting information +about filesystem changes. A remote helper is typically a daemon which +uses inotify to watch the filesystem, and this information is used by +git instead of making expensive system calls like lstat(), open(). + +Typical setup +- + + ++---+ +| Git code (C) |--- requires information about fs changes +|...| +| C fswatch API |--- system calls --- filesystem ++---+ + ^ | + | UNIX socket | + | v ++---+ +| Git fswatch helper|--- daemon inotify-watching --- filesystem ++---+ + + +The Git code will call the C API to obtain changes in filesystem +information. The API will itself call a configured helper (e.g. git +fswatch-notify) which may run filesystem changes, if the remote +helper daemon was started in a previous invocation. If the daemon is +not already running, it is started, and the C API will fall back to +making expensive system calls. + +C API +- + +The credential C API is meant to be called by Git code which needs +information aboutx filesystem changes. It is centered around an +object representing the changes the filesystem since the last +invocation. + +Data Structures +~~~ + +`struct fschanges`:: + + TODO + + +Functions +~ + +TODO + +Example +~~~ + +TODO + +fswatch Helpers +--- + +TODO -- 1.8.1.5 -- 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] perf: update documentation of GIT_PERF_REPEAT_COUNT
Antoine Pelisse apeli...@gmail.com writes: Currently the documentation of GIT_PERF_REPEAT_COUNT says the default is five while perf-lib.sh uses a value of three as a default. Update the documentation so that it is consistent with the code. Signed-off-by: Antoine Pelisse apeli...@gmail.com Acked-by: Thomas Rast tr...@inf.ethz.ch -- Thomas Rast trast@{inf,student}.ethz.ch -- 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/RFC] Make help behaviour more consistent
Previously, the command help and the option -h behaved differently depending on whether a command was specified or not. Old user interface: Commands with no defaults show usage: git git CMD To specifically request usage:git help git CMD -h To get a manual page: git help git git help CMD Two significant usability flaws here: - If using man, man git to side-step git help is obvious. But if trying to use help.format=web, how to get the root html page? My technique was git help XXX and click the git(1) suite link at the bottom. git help git is non-obvious and apparently undocumented (it's not mentioned by git, git help, or git help help...). - Because git itself didn't support -h (and thus actually printed less if you specified it), the general availability of -h for commands was non-obvious. I didn't know about it until I started this patch. Tidy this up, so that help and -h do not change behaviour depending on whether a command is specified or not. New, consistent user interface: Commands with no defaults show usage: git git CMD To specifically request usage:git -hgit CMD -h To get a manual page: git help git help CMD. git help git is still accepted. The legacy --help option behaves as before, which means git --help on its own is now a synonym for git -h, not git help, and it remains consistent with GNU Coding Guidelines. So the only change to existing command behaviour is that git help or git help -w now opens the git manual page, rather than showing common commands. git -h cmd is also accepted as a synonym for git cmd -h, as per Linus's rationale for treating git cmd --help as a synonym for git --help cmd. Option list shown in command-line usage re-ordered to match the manual page, and git and git-help manual pages edited to reflect the new help behaviour. Signed-off-by: Kevin Bracey ke...@bracey.fi --- Documentation/git-help.txt | 22 +- Documentation/git.txt | 17 - builtin/help.c | 9 + git.c | 40 +++- 4 files changed, 41 insertions(+), 47 deletions(-) diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt index e07b6dc..25def9f 100644 --- a/Documentation/git-help.txt +++ b/Documentation/git-help.txt @@ -13,19 +13,16 @@ SYNOPSIS DESCRIPTION --- -With no options and no COMMAND given, the synopsis of the 'git' -command and a list of the most commonly used Git commands are printed -on the standard output. - If the option '--all' or '-a' is given, then all available commands are printed on the standard output. -If a Git subcommand is named, a manual page for that subcommand is brought +Otherwise, a manual page for Git or the specified Git command is brought up. The 'man' program is used by default for this purpose, but this can be overridden by other options or configuration variables. Note that `git --help ...` is identical to `git help ...` because the -former is internally converted into the latter. +former is internally converted into the latter. Also, to supplement +`git help`, most Git commands offer the option '-h' to print usage. OPTIONS --- @@ -36,14 +33,13 @@ OPTIONS -i:: --info:: - Display manual page for the command in the 'info' format. The - 'info' program will be used for that purpose. + Display manual page in the 'info' format. The 'info' program will + be used for that purpose. -m:: --man:: - Display manual page for the command in the 'man' format. This - option may be used to override a value set in the - 'help.format' configuration variable. + Display manual page in the 'man' format. This option may be used to + override a value set in the 'help.format' configuration variable. + By default the 'man' program will be used to display the manual page, but the 'man.viewer' configuration variable may be used to choose @@ -51,8 +47,8 @@ other display programs (see below). -w:: --web:: - Display manual page for the command in the 'web' (HTML) - format. A web browser will be used for that purpose. + Display manual page in the 'web' (HTML) format. A web browser will + be used for that purpose. + The web browser can be specified using the configuration variable 'help.browser', or 'web.browser' if the former is not set. If none of diff --git a/Documentation/git.txt b/Documentation/git.txt index 9d29ed5..51cdca2 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -9,7 +9,7 @@ git - the stupid content tracker SYNOPSIS [verse] -'git' [--version] [--help] [-c name=value] +'git' [--version] [--help] [-h] [-c name=value] [--exec-path[=path]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=path] [--work-tree=path] [--namespace=name]
[PATCH v2 00/23] contrib/subtree: Collected updates
A selection of updates to git-subtree were offered to the list in May of last year ($gmane/196667) by Herman van Rink. At the time the commits were available as either a single commit or a large collection of commits and merges to the git-subtree prior to it's inclusion in contrib/subtree. The following patches take a selection of these commits and rebase them against the tip of master. The git-subtree tests work (make test), but they don't cover any of the new commands added nor the use of the .gittrees file for storing the subtree metadata. If I could ask the original contributors to add their Signed-off-by, I would appreciate it. However I don't have current email addresses for four of them: Peter Jaros, Michael Hart, Paul Cartwright and James Roper. If anyone has current email address for any of these, please either forward the relevant patch(es) to them or let me know so I can do so. Herman van Rink (8): contrib/subtree: Add prune command to OPTS_SPEC contrib/subtree: Remove trailing slash from prefix parameter contrib/subtree: Teach from-submodule to add new subtree to .gittrees contrib/subtree: Document pull-all and push-all contrib/subtree: Document from-submodule and prune commands contrib/subtree: Add missing commands to SYNOPSIS contrib/subtree: Document list command contrib/subtree: Convert spaces to tabs and remove some trailing whitespace James Roper (1): contrib/subtree: Teach push to use --force option Matt Hoffman (6): contrib/subtree: Teach add to store repository branch in .gittrees contrib/subtree: Rename commands push_all/pull_all to push-all/pull-all contrib/subtree: Teach push and pull to use .gittrees if needed contrib/subtree: Replace invisible carriage return with a visible \r contrib/subtree: Add command diff contrib/subtree: Add command list Michael Hart (1): contrib/subtree: Teach push to abort if split fails Nate Jones (1): contrib/subtree: Add command prune Paul Campbell (2): contrib/subtree: Parameters repository/branch for push/pull are optional contrib/subtree: Fix order of case switches so default case is last Paul Cartwright (1): contrib/subtree: Fix typo (s/incldued/included/) Peter Jaros (1): contrib/subtree: Add command from-submodule bibendi (2): contrib/subtree: Teach push and pull to use .gittrees for defaults contrib/subtree: Add commands pull_all and push_all contrib/subtree/git-subtree.sh | 203 contrib/subtree/git-subtree.txt | 46 +++-- 2 files changed, 222 insertions(+), 27 deletions(-) -- 1.8.2.rc1 -- 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 v2 01/23] contrib/subtree: Fix typo (s/incldued/included/)
From: Paul Cartwright paul.cartwri...@ziilabs.com Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt index 7ba853e..e0957ee 100644 --- a/contrib/subtree/git-subtree.txt +++ b/contrib/subtree/git-subtree.txt @@ -270,7 +270,7 @@ git-extensions repository in ~/git-extensions/: name You can omit the --squash flag, but doing so will increase the number -of commits that are incldued in your local repository. +of commits that are included in your local repository. We now have a ~/git-extensions/git-subtree directory containing code from the master branch of git://github.com/apenwarr/git-subtree.git -- 1.8.2.rc1 -- 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 v2 02/23] contrib/subtree: Add command from-submodule
From: Peter Jaros pja...@pivotallabs.com Converts a git-submodule into a git-subtree. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: .gitignore contrib/subtree/git-subtree.sh test.sh --- contrib/subtree/git-subtree.sh | 30 +- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 8a23f58..caf4988 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -14,6 +14,7 @@ git subtree merge --prefix=prefix commit git subtree pull --prefix=prefix repository refspec... git subtree push --prefix=prefix repository refspec... git subtree split --prefix=prefix commit... +git subtree from-submodule --prefix=prefix -- h,helpshow the help q quiet @@ -101,7 +102,7 @@ done command=$1 shift case $command in - add|merge|pull) default= ;; + add|merge|pull|from-submodule) default= ;; split|push) default=--default HEAD ;; *) die Unknown command '$command' ;; esac @@ -721,4 +722,31 @@ cmd_push() fi } +cmd_from-submodule() +{ + ensure_clean + + local submodule_sha=$(git submodule status $prefix | cut -d ' ' -f 2) + + # Remove references to submodule. + git config --remove-section submodule.$prefix + git config --file .gitmodules --remove-section submodule.$prefix + git add .gitmodules + + # Move submodule aside. + local tmp_repo=$(mktemp -d /tmp/git-subtree.X) + rm -r $tmp_repo + mv $prefix $tmp_repo + git rm $prefix + + # Commit changes. + git commit -m Remove '$prefix/' submodule + + # subtree add from submodule repo. + cmd_add_repository $tmp_repo HEAD + + # Remove submodule repo. + rm -rf $tmp_repo +} + cmd_$command $@ -- 1.8.2.rc1 -- 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 v2 03/23] contrib/subtree: Teach add to store repository branch in .gittrees
From: Matt Hoffman matt.hoff...@quantumretail.com The repository and branch of a subtree added with the add command is stored in the .gittrees file. Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 8 1 file changed, 8 insertions(+) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index caf4988..7b70251 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -528,6 +528,14 @@ cmd_add_repository() revs=FETCH_HEAD set -- $revs cmd_add_commit $@ + + # now add it to our list of repos + git config -f .gittrees --unset subtree.$dir.url + git config -f .gittrees --add subtree.$dir.url $repository + git config -f .gittrees --unset subtree.$dir.path + git config -f .gittrees --add subtree.$dir.path $dir + git config -f .gittrees --unset subtree.$dir.branch + git config -f .gittrees --add subtree.$dir.branch $refspec } cmd_add_commit() -- 1.8.2.rc1 -- 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 v2 04/23] contrib/subtree: Teach push and pull to use .gittrees for defaults
From: bibendi bibe...@bk.ru Look in the config file .gittrees for a default repository and refspec or commit when they are not provided on the command line. Uses the .gittrees config file in a similar way to how git-submodule uses the .gitmodules file. Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 28 +++- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 7b70251..1aff956 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -708,21 +708,31 @@ cmd_merge() cmd_pull() { - ensure_clean - git fetch $@ || exit $? - revs=FETCH_HEAD - set -- $revs - cmd_merge $@ +if [ $# -ne 1 ]; then + die You must provide branch + fi + if [ -e $dir ]; then + ensure_clean + repository=$(git config -f .gittrees subtree.$prefix.url) + refspec=$1 + git fetch $repository $refspec || exit $? + echo git fetch using: $repository $refspec + revs=FETCH_HEAD + set -- $revs + cmd_merge $@ + else + die '$dir' must already exist. Try 'git subtree add'. + fi } cmd_push() { - if [ $# -ne 2 ]; then - die You must provide repository refspec + if [ $# -ne 1 ]; then + die You must provide branch fi if [ -e $dir ]; then - repository=$1 - refspec=$2 + repository=$(git config -f .gittrees subtree.$prefix.url) + refspec=$1 echo git push using: $repository $refspec git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec else -- 1.8.2.rc1 -- 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 v2 05/23] contrib/subtree: Add commands pull_all and push_all
From: bibendi bibe...@bk.ru For each subtree listed in .gittrees perform a push or a pull. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: contrib/subtree/git-subtree.sh --- contrib/subtree/git-subtree.sh | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 1aff956..ddae56e 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -12,6 +12,7 @@ git subtree add --prefix=prefix commit git subtree add --prefix=prefix repository commit git subtree merge --prefix=prefix commit git subtree pull --prefix=prefix repository refspec... +git subtree pull_all git subtree push --prefix=prefix repository refspec... git subtree split --prefix=prefix commit... git subtree from-submodule --prefix=prefix @@ -102,16 +103,18 @@ done command=$1 shift case $command in - add|merge|pull|from-submodule) default= ;; + add|merge|pull|from-submodule|pull_all|push_all) default= ;; split|push) default=--default HEAD ;; *) die Unknown command '$command' ;; esac -if [ -z $prefix ]; then +if [ -z $prefix -a $command != pull_all -a $command != push_all ]; then die You must provide the --prefix option. fi case $command in +pull_all);; +push_all);; add) [ -e $prefix ] die prefix '$prefix' already exists. ;; *) [ -e $prefix ] || @@ -120,7 +123,7 @@ esac dir=$(dirname $prefix/.) -if [ $command != pull -a $command != add -a $command != push ]; then +if [ $command != pull -a $command != add -a $command != push -a $command != pull_all ]; then revs=$(git rev-parse $default --revs-only $@) || exit $? dirs=$(git rev-parse --no-revs --no-flags $@) || exit $? if [ -n $dirs ]; then @@ -767,4 +770,20 @@ cmd_from-submodule() rm -rf $tmp_repo } +cmd_pull_all() +{ +git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | +while read path; do +git subtree pull -P $path master || exit $? +done +} + +cmd_push_all() +{ +git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | +while read path; do +git subtree push -P $path master || exit $? +done +} + cmd_$command $@ -- 1.8.2.rc1 -- 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 v2 06/23] contrib/subtree: Rename commands push_all/pull_all to push-all/pull-all
From: Matt Hoffman matt.hoff...@quantumretail.com Changing underscores to dashes (push_all - push-all) Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: .gitignore contrib/subtree/git-subtree.sh --- contrib/subtree/git-subtree.sh | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index ddae56e..39d764b 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -12,7 +12,8 @@ git subtree add --prefix=prefix commit git subtree add --prefix=prefix repository commit git subtree merge --prefix=prefix commit git subtree pull --prefix=prefix repository refspec... -git subtree pull_all +git subtree pull-all +git subtree push-all git subtree push --prefix=prefix repository refspec... git subtree split --prefix=prefix commit... git subtree from-submodule --prefix=prefix @@ -103,18 +104,18 @@ done command=$1 shift case $command in - add|merge|pull|from-submodule|pull_all|push_all) default= ;; + add|merge|pull|from-submodule|pull-all|push-all) default= ;; split|push) default=--default HEAD ;; *) die Unknown command '$command' ;; esac -if [ -z $prefix -a $command != pull_all -a $command != push_all ]; then +if [ -z $prefix -a $command != pull-all -a $command != push-all ]; then die You must provide the --prefix option. fi case $command in -pull_all);; -push_all);; +pull-all);; +push-all);; add) [ -e $prefix ] die prefix '$prefix' already exists. ;; *) [ -e $prefix ] || @@ -123,7 +124,7 @@ esac dir=$(dirname $prefix/.) -if [ $command != pull -a $command != add -a $command != push -a $command != pull_all ]; then +if [ $command != pull -a $command != add -a $command != push -a $command != pull-all ]; then revs=$(git rev-parse $default --revs-only $@) || exit $? dirs=$(git rev-parse --no-revs --no-flags $@) || exit $? if [ -n $dirs ]; then @@ -770,7 +771,7 @@ cmd_from-submodule() rm -rf $tmp_repo } -cmd_pull_all() +cmd_pull-all() { git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | while read path; do @@ -778,7 +779,7 @@ cmd_pull_all() done } -cmd_push_all() +cmd_push-all() { git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | while read path; do -- 1.8.2.rc1 -- 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 v2 07/23] contrib/subtree: Teach push and pull to use .gittrees if needed
From: Matt Hoffman matt.hoff...@quantumretail.com Only when a repository and/or branch are not supplied on the command line will push and pull look for them in the .gittrees file. Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 39d764b..98c508b 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -712,13 +712,21 @@ cmd_merge() cmd_pull() { -if [ $# -ne 1 ]; then - die You must provide branch + if [ $# -gt 2 ]; then + die You should provide either refspec or repository refspec fi if [ -e $dir ]; then ensure_clean - repository=$(git config -f .gittrees subtree.$prefix.url) - refspec=$1 + if [ $# -eq 1 ]; then + repository=$(git config -f .gittrees subtree.$prefix.url) + refspec=$1 + elif [ $# -eq 2 ]; then +repository=$1 +refspec=$2 + else + repository=$(git config -f .gittrees subtree.$prefix.url) +refspec=$(git config -f .gittrees subtree.$prefix.branch) + fi git fetch $repository $refspec || exit $? echo git fetch using: $repository $refspec revs=FETCH_HEAD @@ -731,12 +739,20 @@ cmd_pull() cmd_push() { - if [ $# -ne 1 ]; then - die You must provide branch + if [ $# -gt 2 ]; then + die You shold provide either refspec or repository refspec fi if [ -e $dir ]; then - repository=$(git config -f .gittrees subtree.$prefix.url) - refspec=$1 + if [ $# -eq 1 ]; then + repository=$(git config -f .gittrees subtree.$prefix.url) +refspec=$1 + elif [ $# -eq 2 ]; then +repository=$1 +refspec=$2 + else + repository=$(git config -f .gittrees subtree.$prefix.url) +refspec=$(git config -f .gittrees subtree.$prefix.branch) + fi echo git push using: $repository $refspec git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec else -- 1.8.2.rc1 -- 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 v2 08/23] contrib/subtree: Replace invisible carriage return with a visible \r
From: Matt Hoffman matt.hoff...@quantumretail.com The ctrl-M (^M) character used for the carriage return (CR) is not visible in all (most) text editors and is often silently converted to a new line (NL) or CR/NL combo. 'say' is a wrapper for echo with accepts the option -e to interperet escaped characters. \r becomes a CR, yet is not munged by text editors. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: git-subtree.sh --- contrib/subtree/git-subtree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 98c508b..8056851 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -605,7 +605,7 @@ cmd_split() eval $grl | while read rev parents; do revcount=$(($revcount + 1)) - say -n $revcount/$revmax ($createcount) + say -ne $revcount/$revmax ($createcount)\r debug Processing commit: $rev exists=$(cache_get $rev) if [ -n $exists ]; then -- 1.8.2.rc1 -- 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 v2 09/23] contrib/subtree: Teach push to abort if split fails
From: Michael Hart mich...@adslot.com Added a check to ensure that split succeeds before trying to push. Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 8056851..ae9f87f 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -754,7 +754,12 @@ cmd_push() refspec=$(git config -f .gittrees subtree.$prefix.branch) fi echo git push using: $repository $refspec - git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec + rev=$(git subtree split --prefix=$prefix) + if [ -n $rev ]; then + git push $repository $rev:refs/heads/$refspec + else + die Couldn't push, 'git subtree split' failed. + fi else die '$dir' must already exist. Try 'git subtree add'. fi -- 1.8.2.rc1 -- 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 v2 10/23] contrib/subtree: Add command diff
From: Matt Hoffman matt.hoff...@quantumretail.com Fetches the remote repo as a temporary git-remote then uses git-diff-tree to do comparison before removing the temporary git-remote. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: git-subtree.sh --- contrib/subtree/git-subtree.sh | 34 +- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index ae9f87f..4c3f3c0 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -16,6 +16,7 @@ git subtree pull-all git subtree push-all git subtree push --prefix=prefix repository refspec... git subtree split --prefix=prefix commit... +git subtree diff --prefix=prefix [repository [refspec...]] git subtree from-submodule --prefix=prefix -- h,helpshow the help @@ -105,8 +106,8 @@ command=$1 shift case $command in add|merge|pull|from-submodule|pull-all|push-all) default= ;; - split|push) default=--default HEAD ;; *) die Unknown command '$command' ;; +split|push|diff) default=--default HEAD ;; esac if [ -z $prefix -a $command != pull-all -a $command != push-all ]; then @@ -737,6 +738,37 @@ cmd_pull() fi } +cmd_diff() +{ +if [ -e $dir ]; then +if [ $# -eq 1 ]; then +repository=$(git config -f .gittrees subtree.$prefix.url) +refspec=$1 +elif [ $# -eq 2 ]; then +repository=$1 +refspec=$2 +else +repository=$(git config -f .gittrees subtree.$prefix.url) +refspec=$(git config -f .gittrees subtree.$prefix.branch) +fi +# this is ugly, but I don't know of a better way to do it. My git-fu is weak. +# git diff-tree expects a treeish, but I have only a repository and branch name. +# I don't know how to turn that into a treeish without creating a remote. +# Please change this if you know a better way! +tmp_remote=__diff-tmp +git remote rm $tmp_remote /dev/null 21 +git remote add -t $refspec $tmp_remote $repository /dev/null +# we fetch as a separate step so we can pass -q (quiet), which isn't an option for git remote +# could this instead be git fetch -q $repository $refspec and leave aside creating the remote? +# Still need a treeish for the diff-tree command... +git fetch -q $tmp_remote +git diff-tree -p refs/remotes/$tmp_remote/$refspec +git remote rm $tmp_remote /dev/null 21 +else +die Cannot resolve directory '$dir'. Please point to an existing subtree directory to diff. Try 'git subtree add' to add a subtree. +fi +} + cmd_push() { if [ $# -gt 2 ]; then -- 1.8.2.rc1 -- 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 v2 11/23] contrib/subtree: Add command list
From: Matt Hoffman matt.hoff...@quantumretail.com Lists subtrees from the .gittrees file. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: git-subtree.sh --- contrib/subtree/git-subtree.sh | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 4c3f3c0..7d08064 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -107,10 +107,10 @@ shift case $command in add|merge|pull|from-submodule|pull-all|push-all) default= ;; *) die Unknown command '$command' ;; -split|push|diff) default=--default HEAD ;; +split|push|diff|list) default=--default HEAD ;; esac -if [ -z $prefix -a $command != pull-all -a $command != push-all ]; then +if [ -z $prefix -a $command != pull-all -a $command != push-all -a $command != list ]; then die You must provide the --prefix option. fi @@ -824,6 +824,21 @@ cmd_from-submodule() rm -rf $tmp_repo } +subtree_list() +{ +git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | +while read path; do +repository=$(git config -f .gittrees subtree.$path.url) +refspec=$(git config -f .gittrees subtree.$path.branch) +echo $path(merged from $repository branch $refspec) +done +} + +cmd_list() +{ + subtree_list +} + cmd_pull-all() { git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | -- 1.8.2.rc1 -- 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 v2 12/23] contrib/subtree: Add command prune
From: Nate Jones n...@endot.org Removes entries in .gittrees where the subtree files are no longer present on disk. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: git-subtree.sh --- contrib/subtree/git-subtree.sh | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 7d08064..0c41383 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -105,12 +105,12 @@ done command=$1 shift case $command in - add|merge|pull|from-submodule|pull-all|push-all) default= ;; +add|merge|pull|from-submodule|pull-all|push-all|prune) default= ;; *) die Unknown command '$command' ;; split|push|diff|list) default=--default HEAD ;; esac -if [ -z $prefix -a $command != pull-all -a $command != push-all -a $command != list ]; then +if [ -z $prefix -a $command != pull-all -a $command != push-all -a $command != list -a $command != prune ]; then die You must provide the --prefix option. fi @@ -839,6 +839,17 @@ cmd_list() subtree_list } +cmd_prune() +{ +git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | +while read path; do +if [ ! -e $path ]; then +echo pruning $path +git config -f .gittrees --remove-section subtree.$path +fi +done +} + cmd_pull-all() { git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | -- 1.8.2.rc1 -- 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 v2 13/23] contrib/subtree: Add prune command to OPTS_SPEC
From: Herman van Rink r...@initfour.nl Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: git-subtree.sh --- contrib/subtree/git-subtree.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 0c41383..d67fe5a 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -18,6 +18,7 @@ git subtree push --prefix=prefix repository refspec... git subtree split --prefix=prefix commit... git subtree diff --prefix=prefix [repository [refspec...]] git subtree from-submodule --prefix=prefix +git subtree prune -- h,helpshow the help q quiet -- 1.8.2.rc1 -- 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 v2 14/23] contrib/subtree: Remove trailing slash from prefix parameter
From: Herman van Rink r...@initfour.nl Conflicts: git-subtree.sh Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index d67fe5a..ae7d1fe 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -103,6 +103,9 @@ while [ $# -gt 0 ]; do esac done +# Remove trailing slash +prefix=${prefix%/}; + command=$1 shift case $command in -- 1.8.2.rc1 -- 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 v2 15/23] contrib/subtree: Teach from-submodule to add new subtree to .gittrees
From: Herman van Rink r...@initfour.nl Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: git-subtree.sh --- contrib/subtree/git-subtree.sh | 5 + 1 file changed, 5 insertions(+) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index ae7d1fe..84c90c7 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -806,6 +806,7 @@ cmd_from-submodule() ensure_clean local submodule_sha=$(git submodule status $prefix | cut -d ' ' -f 2) + local submodule_orig_repo=$(git config --file .gitmodules submodule.$prefix.url) # Remove references to submodule. git config --remove-section submodule.$prefix @@ -824,6 +825,10 @@ cmd_from-submodule() # subtree add from submodule repo. cmd_add_repository $tmp_repo HEAD + # Update .gittrees with the original repo url + git config --file .gittrees --unset subtree.$prefix.url + git config --file .gittrees subtree.$prefix.url $submodule_orig_repo + # Remove submodule repo. rm -rf $tmp_repo } -- 1.8.2.rc1 -- 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 v2 16/23] contrib/subtree: Document pull-all and push-all
From: Herman van Rink r...@initfour.nl Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.txt | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt index e0957ee..c8fc103 100644 --- a/contrib/subtree/git-subtree.txt +++ b/contrib/subtree/git-subtree.txt @@ -92,13 +92,19 @@ pull:: Exactly like 'merge', but parallels 'git pull' in that it fetches the given commit from the specified remote repository. - + +pull-all:: + Perform a pull operation on all in .gittrees registered subtrees. + push:: Does a 'split' (see below) using the prefix supplied and then does a 'git push' to push the result to the repository and refspec. This can be used to push your subtree to different branches of the remote repository. +push-all:: + Perform a pull operation on all in .gittrees registered subtrees. + split:: Extract a new, synthetic project history from the history of the prefix subtree. The new history -- 1.8.2.rc1 -- 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 v2 17/23] contrib/subtree: Document from-submodule and prune commands
From: Herman van Rink r...@initfour.nl Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt index c8fc103..48ba158 100644 --- a/contrib/subtree/git-subtree.txt +++ b/contrib/subtree/git-subtree.txt @@ -129,6 +129,16 @@ split:: Note that if you use '--squash' when you merge, you should usually not just '--rejoin' when you split. +from-submodule:: + Convert a git submodule to a subtree. + The module is removed from the .gitmodules file and + the repo contents are integrated as a subtree. + +prune:: + Cleanup .gittrees entries for which the subtree nolonger exists. + +diff:: + TO BE DOCUMENTED OPTIONS --- -- 1.8.2.rc1 -- 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 v2 18/23] contrib/subtree: Add missing commands to SYNOPSIS
From: Herman van Rink r...@initfour.nl Add pull-all, push-all, from-submodule, prune and diff commands to SYNOPSIS. Add alternate parameter option for add command. Use long-form option for specifying prefix. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: contrib/subtree/git-subtree.txt --- contrib/subtree/git-subtree.txt | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt index 48ba158..b485ab5 100644 --- a/contrib/subtree/git-subtree.txt +++ b/contrib/subtree/git-subtree.txt @@ -9,13 +9,16 @@ git-subtree - Merge subtrees together and split repository into subtrees SYNOPSIS [verse] -'git subtree' add -P prefix refspec -'git subtree' add -P prefix repository refspec -'git subtree' pull -P prefix repository refspec... -'git subtree' push -P prefix repository refspec... -'git subtree' merge -P prefix commit -'git subtree' split -P prefix [OPTIONS] [commit] - +'git subtree' add --prefix=prefix repository refspec +'git subtree' merge --prefix=prefix commit +'git subtree' pull --prefix=prefix [repository [refspec...]] +'git subtree' pull-all +'git subtree' push-all +'git subtree' push --prefix=prefix [repository [refspec...]] +'git subtree' split --prefix=prefix commit... +'git subtree' from-submodule --prefix=prefix +'git subtree' prune +'git subtree' diff --prefix=prefix [repository [refspec...]] DESCRIPTION --- -- 1.8.2.rc1 -- 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 v2 19/23] contrib/subtree: Document list command
From: Herman van Rink r...@initfour.nl Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: git-subtree.sh --- contrib/subtree/git-subtree.sh | 1 + contrib/subtree/git-subtree.txt | 4 2 files changed, 5 insertions(+) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 84c90c7..4605203 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -15,6 +15,7 @@ git subtree pull --prefix=prefix repository refspec... git subtree pull-all git subtree push-all git subtree push --prefix=prefix repository refspec... +git subtree list git subtree split --prefix=prefix commit... git subtree diff --prefix=prefix [repository [refspec...]] git subtree from-submodule --prefix=prefix diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt index b485ab5..385bde8 100644 --- a/contrib/subtree/git-subtree.txt +++ b/contrib/subtree/git-subtree.txt @@ -15,6 +15,7 @@ SYNOPSIS 'git subtree' pull-all 'git subtree' push-all 'git subtree' push --prefix=prefix [repository [refspec...]] +'git subtree' list 'git subtree' split --prefix=prefix commit... 'git subtree' from-submodule --prefix=prefix 'git subtree' prune @@ -108,6 +109,9 @@ push:: push-all:: Perform a pull operation on all in .gittrees registered subtrees. +list:: + Show a list of the in .gittrees registered subtrees + split:: Extract a new, synthetic project history from the history of the prefix subtree. The new history -- 1.8.2.rc1 -- 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 v2 20/23] contrib/subtree: Teach push to use --force option
From: James Roper jro...@vz.net Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: contrib/subtree/git-subtree.sh Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 9 - contrib/subtree/git-subtree.txt | 5 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 4605203..3582a55 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -32,6 +32,8 @@ b,branch= create a new branch from the split subtree ignore-joins ignore prior --rejoin commits onto= try connecting new tree to an existing one rejoinmerge the new branch back into HEAD + options for 'push' +f,force use force push options for 'add', 'merge', 'pull' and 'push' squashmerge subtree changes as a single commit @@ -90,6 +92,7 @@ while [ $# -gt 0 ]; do -b) branch=$1; shift ;; -P) prefix=$1; shift ;; -m) message=$1; shift ;; +-f|--force) force=1 ;; --no-prefix) prefix= ;; --onto) onto=$1; shift ;; --no-onto) onto= ;; @@ -790,10 +793,14 @@ cmd_push() repository=$(git config -f .gittrees subtree.$prefix.url) refspec=$(git config -f .gittrees subtree.$prefix.branch) fi +push_opts= +if [ $force == 1 ]; then +push_opts=$push_opts --force +fi echo git push using: $repository $refspec rev=$(git subtree split --prefix=$prefix) if [ -n $rev ]; then - git push $repository $rev:refs/heads/$refspec + git push $push_opts $repository $rev:refs/heads/$refspec else die Couldn't push, 'git subtree split' failed. fi diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt index 385bde8..9e9eb9e 100644 --- a/contrib/subtree/git-subtree.txt +++ b/contrib/subtree/git-subtree.txt @@ -278,6 +278,11 @@ OPTIONS FOR split '--rejoin' when you split, because you don't want the subproject's history to be part of your project anyway. +OPTIONS FOR push + +-f:: +--force:: +Uses 'git push --force'. EXAMPLE 1. Add command -- -- 1.8.2.rc1 -- 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 v2 21/23] contrib/subtree: Convert spaces to tabs and remove some trailing whitespace
From: Herman van Rink r...@initfour.nl Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: contrib/subtree/.gitignore contrib/subtree/git-subtree.sh contrib/subtree/test.sh --- It's a nasty formatting only patch and I won't be surprised or too dissappiointed if this doesn't make it. Or are the rules for this more lax for contrib? How else can contrib be brought in-line with coding standards? contrib/subtree/git-subtree.sh | 213 + 1 file changed, 109 insertions(+), 104 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 3582a55..263ea9f 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -92,7 +92,7 @@ while [ $# -gt 0 ]; do -b) branch=$1; shift ;; -P) prefix=$1; shift ;; -m) message=$1; shift ;; --f|--force) force=1 ;; + -f|--force) force=1 ;; --no-prefix) prefix= ;; --onto) onto=$1; shift ;; --no-onto) onto= ;; @@ -123,8 +123,10 @@ if [ -z $prefix -a $command != pull-all -a $command != push-all -a $c fi case $command in -pull-all);; -push-all);; + pull-all);; + push-all);; + list);; + prune);; add) [ -e $prefix ] die prefix '$prefix' already exists. ;; *) [ -e $prefix ] || @@ -541,14 +543,14 @@ cmd_add_repository() revs=FETCH_HEAD set -- $revs cmd_add_commit $@ - - # now add it to our list of repos - git config -f .gittrees --unset subtree.$dir.url - git config -f .gittrees --add subtree.$dir.url $repository - git config -f .gittrees --unset subtree.$dir.path - git config -f .gittrees --add subtree.$dir.path $dir - git config -f .gittrees --unset subtree.$dir.branch - git config -f .gittrees --add subtree.$dir.branch $refspec + + # now add it to our list of repos + git config -f .gittrees --unset subtree.$dir.url + git config -f .gittrees --add subtree.$dir.url $repository + git config -f .gittrees --unset subtree.$dir.path + git config -f .gittrees --add subtree.$dir.path $dir + git config -f .gittrees --unset subtree.$dir.branch + git config -f .gittrees --add subtree.$dir.branch $refspec } cmd_add_commit() @@ -721,89 +723,91 @@ cmd_merge() cmd_pull() { - if [ $# -gt 2 ]; then - die You should provide either refspec or repository refspec + if [ $# -gt 2 ]; then + die You should provide either refspec or repository refspec fi if [ -e $dir ]; then - ensure_clean - if [ $# -eq 1 ]; then - repository=$(git config -f .gittrees subtree.$prefix.url) - refspec=$1 - elif [ $# -eq 2 ]; then -repository=$1 -refspec=$2 - else - repository=$(git config -f .gittrees subtree.$prefix.url) -refspec=$(git config -f .gittrees subtree.$prefix.branch) - fi - git fetch $repository $refspec || exit $? - echo git fetch using: $repository $refspec - revs=FETCH_HEAD - set -- $revs - cmd_merge $@ + ensure_clean + if [ $# -eq 1 ]; then + repository=$(git config -f .gittrees subtree.$prefix.url) + refspec=$1 + elif [ $# -eq 2 ]; then + repository=$1 + refspec=$2 + else + repository=$(git config -f .gittrees subtree.$prefix.url) + refspec=$(git config -f .gittrees subtree.$prefix.branch) + fi + git fetch $repository $refspec || exit $? + echo git fetch using: $repository $refspec + revs=FETCH_HEAD + set -- $revs + cmd_merge $@ else - die '$dir' must already exist. Try 'git subtree add'. + die '$dir' must already exist. Try 'git subtree add'. fi } -cmd_diff() -{ -if [ -e $dir ]; then -if [ $# -eq 1 ]; then -repository=$(git config -f .gittrees subtree.$prefix.url) -refspec=$1 -elif [ $# -eq 2 ]; then -repository=$1 -refspec=$2 -else -repository=$(git config -f .gittrees subtree.$prefix.url) -refspec=$(git config -f .gittrees subtree.$prefix.branch) -fi -# this is ugly, but I don't know of a better way to do it. My git-fu is weak. -# git diff-tree expects a treeish, but I have only a repository and branch name. -# I don't know how to turn that into a treeish without creating a remote. -# Please change this if you know a better way! -tmp_remote=__diff-tmp -git remote rm $tmp_remote /dev/null 21 -git remote add -t $refspec $tmp_remote
[PATCH v2 22/23] contrib/subtree: Parameters repository/branch for push/pull are optional
Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 263ea9f..aaee6ae 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -11,10 +11,10 @@ OPTS_SPEC=\ git subtree add --prefix=prefix commit git subtree add --prefix=prefix repository commit git subtree merge --prefix=prefix commit -git subtree pull --prefix=prefix repository refspec... +git subtree pull --prefix=prefix [repository [refspec...]] git subtree pull-all git subtree push-all -git subtree push --prefix=prefix repository refspec... +git subtree push --prefix=prefix [repository [refspec...]] git subtree list git subtree split --prefix=prefix commit... git subtree diff --prefix=prefix [repository [refspec...]] -- 1.8.2.rc1 -- 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 v2 23/23] contrib/subtree: Fix order of case switches so default case is last
Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index aaee6ae..fb6f044 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -113,9 +113,9 @@ prefix=${prefix%/}; command=$1 shift case $command in -add|merge|pull|from-submodule|pull-all|push-all|prune) default= ;; + add|merge|pull|pull-all|push-all|from-submodule|prune) default= ;; + split|push|diff|list) default=--default HEAD ;; *) die Unknown command '$command' ;; -split|push|diff|list) default=--default HEAD ;; esac if [ -z $prefix -a $command != pull-all -a $command != push-all -a $command != list -a $command != prune ]; then -- 1.8.2.rc1 -- 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/RFC] Make help behaviour more consistent
On 10/03/13 17:48, Kevin Bracey wrote: Previously, the command help and the option -h behaved differently depending on whether a command was specified or not. Old user interface: Commands with no defaults show usage: git git CMD To specifically request usage:git help git CMD -h To get a manual page: git help git git help CMD I agree they were inconsistent, but the change should also consider how the help for 'git help' should be provided as well. I have some patches in preparation for also listing the commonly used guides, which can also be accessed by the existing `git help guide` e.g. 'tutorial' (but not user-manual or everday git unfortunately). http://permalink.gmane.org/gmane.comp.version-control.git/217354 I have a new version in prep but my ubuntu m/c is out of action. Two significant usability flaws here: - If using man, man git to side-step git help is obvious. But if trying to use help.format=web, how to get the root html page? My technique was git help XXX and click the git(1) suite link at the bottom. git help git is non-obvious and apparently undocumented (it's not mentioned by git, git help, or git help help...). - Because git itself didn't support -h (and thus actually printed less if you specified it), the general availability of -h for commands was non-obvious. I didn't know about it until I started this patch. Tidy this up, so that help and -h do not change behaviour depending on whether a command is specified or not. New, consistent user interface: Commands with no defaults show usage: git git CMD To specifically request usage:git -hgit CMD -h To get a manual page: git help git help CMD. git help git is still accepted. The legacy --help option behaves as before, which means git --help on its own is now a synonym for git -h, not git help, and it remains consistent with GNU Coding Guidelines. So the only change to existing command behaviour is that git help or git help -w now opens the git manual page, rather than showing common commands. git -h cmd is also accepted as a synonym for git cmd -h, as per Linus's rationale for treating git cmd --help as a synonym for git --help cmd. Option list shown in command-line usage re-ordered to match the manual page, and git and git-help manual pages edited to reflect the new help behaviour. Signed-off-by: Kevin Bracey ke...@bracey.fi --- Documentation/git-help.txt | 22 +- Documentation/git.txt | 17 - builtin/help.c | 9 + git.c | 40 +++- 4 files changed, 41 insertions(+), 47 deletions(-) diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt index e07b6dc..25def9f 100644 --- a/Documentation/git-help.txt +++ b/Documentation/git-help.txt @@ -13,19 +13,16 @@ SYNOPSIS DESCRIPTION --- -With no options and no COMMAND given, the synopsis of the 'git' -command and a list of the most commonly used Git commands are printed -on the standard output. - If the option '--all' or '-a' is given, then all available commands are printed on the standard output. -If a Git subcommand is named, a manual page for that subcommand is brought +Otherwise, a manual page for Git or the specified Git command is brought up. The 'man' program is used by default for this purpose, but this can be overridden by other options or configuration variables. Note that `git --help ...` is identical to `git help ...` because the -former is internally converted into the latter. +former is internally converted into the latter. Also, to supplement +`git help`, most Git commands offer the option '-h' to print usage. OPTIONS --- @@ -36,14 +33,13 @@ OPTIONS -i:: --info:: - Display manual page for the command in the 'info' format. The - 'info' program will be used for that purpose. + Display manual page in the 'info' format. The 'info' program will + be used for that purpose. -m:: --man:: - Display manual page for the command in the 'man' format. This - option may be used to override a value set in the - 'help.format' configuration variable. + Display manual page in the 'man' format. This option may be used to + override a value set in the 'help.format' configuration variable. + By default the 'man' program will be used to display the manual page, but the 'man.viewer' configuration variable may be used to choose @@ -51,8 +47,8 @@ other display programs (see below). -w:: --web:: - Display manual page for the command in the 'web' (HTML) - format. A web browser will be used for that purpose. + Display manual page in the 'web' (HTML) format. A web browser will + be used for that purpose. + The web browser can be specified using the configuration variable 'help.browser', or 'web.browser' if
[PATCH 0/2] fix git-archive with empty trees
I noticed that git archive will barf when the root tree is empty. Instead, it should probably return an empty archive. I doubt many people really care about this corner case in practice, but it seems like we should handle it more gracefully (and it's an easy fix). It came to my attention because we track failed git-archive invocations at GitHub, and a particular repo had a two commits: adding some content, then reverting the original commit. You can also get there with commit --allow-empty on a new branch (which is what the tests do). I didn't bother even looking at empty subtrees. AFAIK, git should never produce them (it omits the tree entirely if there is no content in it). You would have to fake it using hash-object manually. I suspect it would work just fine, as we already exercise the empty-dir code paths in the tests I did add. [1/2]: test-lib: factor out $GIT_UNZIP setup [2/2]: archive: handle commits with an empty tree -Peff -- 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 1/2] test-lib: factor out $GIT_UNZIP setup
We set up the $GIT_UNZIP variable and lazy prereq in multiple places (and the next patch is about to add another one). Let's factor it out to avoid repeating ourselves. Signed-off-by: Jeff King p...@peff.net --- t/t0024-crlf-archive.sh | 6 -- t/t5003-archive-zip.sh | 6 -- t/test-lib.sh | 6 ++ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh index 5378787..4e9fa3c 100755 --- a/t/t0024-crlf-archive.sh +++ b/t/t0024-crlf-archive.sh @@ -3,12 +3,6 @@ test_description='respect crlf in git archive' test_description='respect crlf in git archive' . ./test-lib.sh -GIT_UNZIP=${GIT_UNZIP:-unzip} - -test_lazy_prereq UNZIP ' - $GIT_UNZIP -v - test $? -ne 127 -' test_expect_success setup ' diff --git a/t/t5003-archive-zip.sh b/t/t5003-archive-zip.sh index 7cfe9ca..0f5b42b 100755 --- a/t/t5003-archive-zip.sh +++ b/t/t5003-archive-zip.sh @@ -3,15 +3,9 @@ SUBSTFORMAT=%H%n test_description='git archive --format=zip test' . ./test-lib.sh -GIT_UNZIP=${GIT_UNZIP:-unzip} SUBSTFORMAT=%H%n -test_lazy_prereq UNZIP ' - $GIT_UNZIP -v - test $? -ne 127 -' - test_lazy_prereq UNZIP_SYMLINKS ' ( mkdir unzip-symlinks diff --git a/t/test-lib.sh b/t/test-lib.sh index 9e7f6b4..1f51025 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -760,3 +760,9 @@ test -w / || test_set_prereq SANITY # When the tests are run as root, permission tests will report that # things are writable when they shouldn't be. test -w / || test_set_prereq SANITY + +GIT_UNZIP=${GIT_UNZIP:-unzip} +test_lazy_prereq UNZIP ' + $GIT_UNZIP -v + test $? -ne 127 +' -- 1.8.2.rc3.4.gc6ed371 -- 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 2/2] archive: handle commits with an empty tree
git-archive relies on get_pathspec to convert its argv into a list of pathspecs. When get_pathspec is given an empty argv list, it returns a single pathspec, the empty string, to indicate that everything matches. When we feed this to our path_exists function, we typically see that the pathspec turns up at least one item in the tree, and we are happy. But when our tree is empty, we erroneously think it is because the pathspec is too limited, when in fact it is simply that there is nothing to be found in the tree. This is a weird corner case, but the correct behavior is almost certainly to produce an empty archive, not to exit with an error. This patch teaches git-archive to create empty archives when there is no pathspec given (we continue to complain if a pathspec is given, since it obviously is not matched). It also confirms that the tar and zip writers produce sane output in this instance. Signed-off-by: Jeff King p...@peff.net --- archive.c | 2 +- t/t5004-archive-corner-cases.sh | 83 t/t5004/empty.zip | Bin 0 - 62 bytes 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100755 t/t5004-archive-corner-cases.sh create mode 100644 t/t5004/empty.zip diff --git a/archive.c b/archive.c index 93e00bb..d254fa5 100644 --- a/archive.c +++ b/archive.c @@ -234,7 +234,7 @@ static void parse_pathspec_arg(const char **pathspec, ar_args-pathspec = pathspec = get_pathspec(, pathspec); if (pathspec) { while (*pathspec) { - if (!path_exists(ar_args-tree, *pathspec)) + if (**pathspec !path_exists(ar_args-tree, *pathspec)) die(path not found: %s, *pathspec); pathspec++; } diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh new file mode 100755 index 000..395dd58 --- /dev/null +++ b/t/t5004-archive-corner-cases.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +test_description='test corner cases of git-archive' +. ./test-lib.sh + +test_expect_success 'create commit with empty tree' ' + git commit --allow-empty -m foo +' + +# Make a dir and clean it up afterwards +make_dir() { + mkdir $1 + test_when_finished rm -rf '$1' +} + +# Check that the dir given in $1 contains exactly the +# set of paths given as arguments. +check_dir() { + dir=$1; shift + { + echo $dir + for i in $@; do + echo $dir/$i + done + } | sort expect + find $dir -print | sort actual + test_cmp expect actual +} + +test_expect_success 'tar archive of empty tree is empty' ' + git archive --format=tar HEAD empty.tar + make_dir extract + $TAR xf empty.tar -C extract + check_dir extract +' + +test_expect_success 'tar archive of empty tree with prefix' ' + git archive --format=tar --prefix=foo/ HEAD prefix.tar + make_dir extract + $TAR xf prefix.tar -C extract + check_dir extract foo +' + +test_expect_success UNZIP 'zip archive of empty tree is empty' ' + # Detect the exit code produced when our particular flavor of unzip + # sees an empty archive. Infozip will generate a warning and exit with + # code 1. But in the name of sanity, we do not expect other unzip + # implementations to do the same thing (it would be perfectly + # reasonable to exit 0, for example). + # + # This makes our test less rigorous on some platforms (unzip may not + # handle the empty repo at all, making our later check of its exit code + # a no-op). But we cannot do anything reasonable except skip the test + # on such platforms anyway, and this is the moral equivalent. + $GIT_UNZIP $TEST_DIRECTORY/t5004/empty.zip + expect_code=$? + + git archive --format=zip HEAD empty.zip + make_dir extract + ( + cd extract + test_expect_code $expect_code $GIT_UNZIP ../empty.zip + ) + check_dir extract +' + +test_expect_success UNZIP 'zip archive of empty tree with prefix' ' + # We do not have to play exit-code tricks here, because our + # result should not be empty; it has a directory in it. + git archive --format=zip --prefix=foo/ HEAD prefix.zip + make_dir extract + ( + cd extract + $GIT_UNZIP ../prefix.zip + ) + check_dir extract foo +' + +test_expect_success 'archive complains about pathspec on empty tree' ' + test_must_fail git archive --format=tar HEAD -- foo /dev/null +' + +test_done diff --git a/t/t5004/empty.zip b/t/t5004/empty.zip new file mode 100644 index ..1a76bb600558dc94913a80076fe8dbdef13c1b15 GIT binary patch literal 62 zcmWIWW@TeQ0~!oz$rh;wDW;amhRMmM$%ZCLW|oGQX-P%~24+b{=4q+M#^$N!DF$k D8w?B~ literal 0 HcmV?d1
Re: [PATCH/RFC] Make help behaviour more consistent
Kevin Bracey ke...@bracey.fi writes: Previously, the command help and the option -h behaved differently depending on whether a command was specified or not. Old user interface: Commands with no defaults show usage: git git CMD To specifically request usage:git help git CMD -h To get a manual page: git help git git help CMD Two significant usability flaws here: - If using man, man git to side-step git help is obvious. But if trying to use help.format=web, how to get the root html page? My technique was git help XXX and click the git(1) suite link at the bottom. git help git is non-obvious and apparently undocumented (it's not mentioned by git, git help, or git help help...). - Because git itself didn't support -h (and thus actually printed less if you specified it), the general availability of -h for commands was non-obvious. I didn't know about it until I started this patch. Hmm, I feel more confused than convinced after reading the above three times. Perhaps that is because I am too used to the way how git potty itself behaves, especially the part that git help git is the way to ask git (the first token on the command line) to give me help about git (the second) itself. Having said that, I would agree that git -h that shows a unknown option error message that lists the supported command line options (just like how it reacts to git -x) is less friendly than git that knows -h to show the short help text, and that part of the patch is a definite improvement. But other than that I do not see any significant usablity flow in it. The patch seems to do a lot more than just teaching git to react to -h to give a short usage, instead of doing the generic I do not know -h option thing. I am not sure what merit these other changes of this patch have. In the introductory part, you list three possibilities, but there is the fourth git help help to ask git to give me help about help. Depending on where one comes from, that may also seem just as odd as git help git (again, I personally find neither is odd, though). Would this change help with that usability flaw as well? Undecided... -- 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 v2 02/23] contrib/subtree: Add command from-submodule
Paul Campbell pcampb...@kemitix.net writes: @@ -721,4 +722,31 @@ cmd_push() fi } +cmd_from-submodule() +{ I know contrib/subtree does not work with anything other than bash, and bash may accept this as a valid function name, but if you can avoid it easily I would prefer not to see a non-POSIX construct like this in my tree, even in contrib/ part: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_230 because people often reference random parts of the tree and mimick what existing code does. + ensure_clean + + local submodule_sha=$(git submodule status $prefix | cut -d ' ' -f 2) Is $prefix guaranteed not to have any $IFS whitespaces? + # Remove references to submodule. + git config --remove-section submodule.$prefix + git config --file .gitmodules --remove-section submodule.$prefix + git add .gitmodules + + # Move submodule aside. + local tmp_repo=$(mktemp -d /tmp/git-subtree.X) Doesn't git subtree honor TMPDIR? Not complaining, but being curious. + rm -r $tmp_repo + mv $prefix $tmp_repo + git rm $prefix Is $prefix guaranteed not to have any $IFS whitespaces? + + # Commit changes. + git commit -m Remove '$prefix/' submodule + + # subtree add from submodule repo. + cmd_add_repository $tmp_repo HEAD + + # Remove submodule repo. + rm -rf $tmp_repo +} + cmd_$command $@ -- 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 v2 03/23] contrib/subtree: Teach add to store repository branch in .gittrees
Paul Campbell pcampb...@kemitix.net writes: From: Matt Hoffman matt.hoff...@quantumretail.com The repository and branch of a subtree added with the add command is stored in the .gittrees file. Signed-off-by: Paul Campbell pcampb...@kemitix.net --- contrib/subtree/git-subtree.sh | 8 1 file changed, 8 insertions(+) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index caf4988..7b70251 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -528,6 +528,14 @@ cmd_add_repository() revs=FETCH_HEAD set -- $revs cmd_add_commit $@ + + # now add it to our list of repos + git config -f .gittrees --unset subtree.$dir.url + git config -f .gittrees --add subtree.$dir.url $repository + git config -f .gittrees --unset subtree.$dir.path + git config -f .gittrees --add subtree.$dir.path $dir + git config -f .gittrees --unset subtree.$dir.branch + git config -f .gittrees --add subtree.$dir.branch $refspec Existing code in the function this touches seem to be written carefully to allow $IFS whitespace in $dir, but this change butchers it, it seems. Also, where does $refspec come from? When this is called from cmd_add_repository(), there is an assignment to the variable, but it is not all clear. As git-subtree declares it won't work with anything but bash, I think things like this should take advantage of being written for bash by using local and passing arguments explicitly instead of relying on global variables, which POSIX shell scripts cannot afford to do but bash scripts can. } cmd_add_commit() -- 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 v2 04/23] contrib/subtree: Teach push and pull to use .gittrees for defaults
From: bibendi bibe...@bk.ru Look in the config file .gittrees for a default repository and refspec or commit when they are not provided on the command line. Uses the .gittrees config file in a similar way to how git-submodule uses the .gitmodules file. What the patch does can be read from the code, but what benefit would users get by the extra file? cmd_pull() { - ensure_clean - git fetch $@ || exit $? - revs=FETCH_HEAD - set -- $revs - cmd_merge $@ +if [ $# -ne 1 ]; then Broken indentation? + die You must provide branch + fi It used to allow git fetch $there and let the configured remote.$there.fetch refspec to decide what gets fetched, and also it used to allow git fetch $there $that_branch to explicitly fetch the named branch. But this change insists that the user has to give what gets fetched from the command line and forbids the user from giving where to fetch from, it seems. Isn't it a regression? Why is it a good idea to forbid such uses that the script used to accept? The proposed log message does not explain why it is not a regression, or why accepting some use patterns that the script used to allow was a bug that needs to be diagnosed with this new conditional. + if [ -e $dir ]; then + ensure_clean + repository=$(git config -f .gittrees subtree.$prefix.url) + refspec=$1 + git fetch $repository $refspec || exit $? + echo git fetch using: $repository $refspec Why are these variable references outside the dq pair? -- 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 v2 05/23] contrib/subtree: Add commands pull_all and push_all
Paul Campbell pcampb...@kemitix.net writes: From: bibendi bibe...@bk.ru For each subtree listed in .gittrees perform a push or a pull. Signed-off-by: Paul Campbell pcampb...@kemitix.net Conflicts: contrib/subtree/git-subtree.sh The Conflicts: part is totally irrelevant. Please remove. --- contrib/subtree/git-subtree.sh | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 1aff956..ddae56e 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -12,6 +12,7 @@ git subtree add --prefix=prefix commit git subtree add --prefix=prefix repository commit git subtree merge --prefix=prefix commit git subtree pull --prefix=prefix repository refspec... +git subtree pull_all Why isn't it pull --all? git subtree push --prefix=prefix repository refspec... Where did push_all go? +cmd_pull_all() +{ +git config -f .gittrees -l | grep subtree | grep path | grep -o '=.*' | grep -o '[^=].*' | grep -o is not even in POSIX. Besides, what is this trying to parse? Is it expected to match lines like path.subtree=trash with this, or is it more like you only want something like this: subtree.over/there.path=foo in which case you would want to read with something like sed -n -e 's/^subtree\...*\.path=\(.*\)/\1/p' instead (modulo the usual caveat on $IFS whitespaces in path)? +while read path; do +git subtree pull -P $path master || exit $? +done +} I'd stop looking at this series myself at this step for now. -- 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: Memory corruption when rebasing with git version 1.8.1.5 on arch
On Sun, Mar 10, 2013 at 12:45:43PM +0100, Bernhard Posselt wrote: valgrind -q --trace-children=yes --log-file=/tmp/valgrind.out \ git pull --rebase https://github.com/Raydiation/core The log file was empty and it seemed to apply everything nice when running valgrind. When i tried to run it without valgrind it failed with memory corruption. Thanks, we are maybe getting closer. It's weird that it works OK with valgrind. If the valgrind log is empty, though, I'm confused about where the output you pasted below came from. ==22291== Invalid write of size 1 ==22291==at 0x4C2DB93: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==22291==by 0x4076B1: update_pre_post_images (in /usr/lib/git-core/git) ==22291==by 0x40A60F: apply_fragments (in /usr/lib/git-core/git) ==22291==by 0x40C29F: check_patch_list (in /usr/lib/git-core/git) ==22291==by 0x40CC35: apply_patch (in /usr/lib/git-core/git) ==22291==by 0x40F584: cmd_apply (in /usr/lib/git-core/git) ==22291==by 0x4058E7: handle_internal_command (in /usr/lib/git-core/git) ==22291==by 0x404DD1: main (in /usr/lib/git-core/git) Hmm, it would be nice to have line numbers. Can you try compiling with -g -O0? The function where the problem is deals with whitespace munging. Just a guess, but do you have any whitespace config options set (e.g., apply.whitespace)? -Peff -- 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 0/2] fix git-archive with empty trees
Jeff King p...@peff.net writes: On Sun, Mar 10, 2013 at 09:31:24PM -0400, Jeff King wrote: I noticed that git archive will barf when the root tree is empty. [...] I didn't bother even looking at empty subtrees. AFAIK, git should never produce them (it omits the tree entirely if there is no content in it). You would have to fake it using hash-object manually. I suspect it would work just fine, as we already exercise the empty-dir code paths in the tests I did add. Curious, I went ahead and tested this. It does indeed work as expected. Interesting. The following tests can be squashed into patch 2/2 if we want: Why not---will do. Thanks. diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh index 395dd58..cdb7d7a 100755 --- a/t/t5004-archive-corner-cases.sh +++ b/t/t5004-archive-corner-cases.sh @@ -80,4 +80,23 @@ test_expect_success 'archive complains about pathspec on empty tree' ' test_must_fail git archive --format=tar HEAD -- foo /dev/null ' +test_expect_success 'create a commit with an empty subtree' ' + empty_tree=$(git hash-object -t tree /dev/null) + root_tree=$(printf 04 tree $empty_tree\tsub\n | git mktree) +' + +test_expect_success 'archive empty subtree with no pathspec' ' + git archive --format=tar $root_tree subtree-all.tar + make_dir extract + $TAR xf subtree-all.tar -C extract + check_dir extract sub +' + +test_expect_success 'archive empty subtree by direct pathspec' ' + git archive --format=tar $root_tree -- sub subtree-path.tar + make_dir extract + $TAR xf subtree-path.tar -C extract + check_dir extract sub +' + test_done -- 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