[PATCH 1/5] t2004: modernize style
In particular: * indent test body * place test description on same line as test_expect_* * place closing quote on its own line * name output file "actual" rather than "out" * name setup test "setup" rather than "preparation" Signed-off-by: Eric Sunshine --- t/t2004-checkout-cache-temp.sh | 391 + 1 file changed, 196 insertions(+), 195 deletions(-) diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh index f171a55..28e50d6 100755 --- a/t/t2004-checkout-cache-temp.sh +++ b/t/t2004-checkout-cache-temp.sh @@ -10,202 +10,203 @@ rather than the tracked path.' . ./test-lib.sh -test_expect_success \ -'preparation' ' -mkdir asubdir && -echo tree1path0 >path0 && -echo tree1path1 >path1 && -echo tree1path3 >path3 && -echo tree1path4 >path4 && -echo tree1asubdir/path5 >asubdir/path5 && -git update-index --add path0 path1 path3 path4 asubdir/path5 && -t1=$(git write-tree) && -rm -f path* .merge_* out .git/index && -echo tree2path0 >path0 && -echo tree2path1 >path1 && -echo tree2path2 >path2 && -echo tree2path4 >path4 && -git update-index --add path0 path1 path2 path4 && -t2=$(git write-tree) && -rm -f path* .merge_* out .git/index && -echo tree2path0 >path0 && -echo tree3path1 >path1 && -echo tree3path2 >path2 && -echo tree3path3 >path3 && -git update-index --add path0 path1 path2 path3 && -t3=$(git write-tree)' - -test_expect_success \ -'checkout one stage 0 to temporary file' ' -rm -f path* .merge_* out .git/index && -git read-tree $t1 && -git checkout-index --temp -- path1 >out && -test_line_count = 1 out && -test $(cut "-d " -f2 out) = path1 && -p=$(cut "-d" -f1 out) && -test -f $p && -test $(cat $p) = tree1path1' - -test_expect_success \ -'checkout all stage 0 to temporary files' ' -rm -f path* .merge_* out .git/index && -git read-tree $t1 && -git checkout-index -a --temp >out && -test_line_count = 5 out && -for f in path0 path1 path3 path4 asubdir/path5 -do - test $(grep $f out | cut "-d" -f2) = $f && - p=$(grep $f out | cut "-d " -f1) && +test_expect_success 'setup' ' + mkdir asubdir && + echo tree1path0 >path0 && + echo tree1path1 >path1 && + echo tree1path3 >path3 && + echo tree1path4 >path4 && + echo tree1asubdir/path5 >asubdir/path5 && + git update-index --add path0 path1 path3 path4 asubdir/path5 && + t1=$(git write-tree) && + rm -f path* .merge_* actual .git/index && + echo tree2path0 >path0 && + echo tree2path1 >path1 && + echo tree2path2 >path2 && + echo tree2path4 >path4 && + git update-index --add path0 path1 path2 path4 && + t2=$(git write-tree) && + rm -f path* .merge_* actual .git/index && + echo tree2path0 >path0 && + echo tree3path1 >path1 && + echo tree3path2 >path2 && + echo tree3path3 >path3 && + git update-index --add path0 path1 path2 path3 && + t3=$(git write-tree) +' + +test_expect_success 'checkout one stage 0 to temporary file' ' + rm -f path* .merge_* actual .git/index && + git read-tree $t1 && + git checkout-index --temp -- path1 >actual && + test_line_count = 1 actual && + test $(cut "-d " -f2 actual) = path1 && + p=$(cut "-d " -f1 actual) && test -f $p && - test $(cat $p) = tree1$f -done' - -test_expect_success \ -'prepare 3-way merge' ' -rm -f path* .merge_* out .git/index && -git read-tree -m $t1 $t2 $t3' - -test_expect_success \ -'checkout one stage 2 to temporary file' ' -rm -f path* .merge_* out && -git checkout-index --stage=2 --temp -- path1 >out && -test_line_count = 1 out && -test $(cut "-d " -f2 out) = path1 && -p=$(cut "-d" -f1 out) && -test -f $p && -test $(cat $p) = tree2path1' - -test_expect_success \ -'checkout all stage 2 to temporary files' ' -rm -f path* .merge_* out && -git checkout-index --all --stage=2 --temp >out && -test_line_count = 3 out && -for f in path1 path2 path4 -do - test $(grep $f out | cut "-d" -f2) = $f && - p=$(grep $f out | cut "-d " -f1) && + test $(cat $p) = tree1path1 +' + +test_expect_success 'checkout all stage 0 to temporary files' ' + rm -f path* .merge_* actual .git/index && + git read-tree $t1 && + git checkout-index -a --temp >actual && + test_line_count = 5 actual && + for f in path0 path1 path3 path4 asubdir/path5 + do + test $(grep $f actual | cut "-d " -f2) = $f && + p=$(grep $f actual | cut "-d" -f1) && + test -f $p && + test $(cat $p) = tree1$f + done +' + +test_expect_success 'setup 3-way merge' ' + rm -f path* .merge_* actual .git/index && + git read-tree -m $t1 $t2 $t3 +' + +test_expect_success 'checkout one stage 2 to temporary file' ' + rm -f path* .merge_* actual && + git checkout-index --stage=2 --temp -- path1 >actual && + test_line_count = 1 actual && + test $(cut "-d " -f2
[PATCH 0/5] resolve checkout-index --temp path mangling
This patch series fixes a path mangling bug in checkout-index --temp reported by Russ Cox[1]. As a bonus, it also squashes a bug in which checkout-index was accessing and printing memory beyond end-of-string. [1]: http://thread.gmane.org/gmane.comp.version-control.git/261739 Eric Sunshine (5): t2004: modernize style t2004: drop unnecessary write-tree/read-tree t2004: standardize file naming in symlink test t2004: demonstrate broken relative path printing checkout-index: fix --temp relative path mangling builtin/checkout-index.c | 16 +- t/t2004-checkout-cache-temp.sh | 400 + 2 files changed, 213 insertions(+), 203 deletions(-) -- 2.2.1.267.g0ad48de -- 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 4/5] t2004: demonstrate broken relative path printing
checkout-index --temp only properly prints relative paths which are descendants of the current directory. Paths in ancestor or sibling directories (or their children) are often printed in mangled form. For example: mkdir a bbb && >file && >bbb/file && git update-index --add file bbb/file && cd a && git checkout-index --temp ../file ../bbb/file prints: .merge_file_ooblek le .merge_file_igloo0 b/file rather than the correct: .merge_file_ooblek ../file .merge_file_igloo0 ../bbb/file Unfortunately, testing is complicated slightly by relative paths sometimes _appearing_ to be printed correctly, but this is an accident of implementation in which a "correct" copy of the string exists in memory beyond the end of the real string, and that "correct" copy gets printed. This test takes care to avoid the accidentally "correct" behavior by testing with a filename longer than the directory name in which checkout-index is invoked. Signed-off-by: Eric Sunshine --- t/t2004-checkout-cache-temp.sh | 12 1 file changed, 12 insertions(+) diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh index 602fbc7..3c2b2b9 100755 --- a/t/t2004-checkout-cache-temp.sh +++ b/t/t2004-checkout-cache-temp.sh @@ -206,4 +206,16 @@ test_expect_success 'checkout --temp symlink' ' test $(cat $p) = path7 ' +test_expect_failure 'emit well-formed relative path' ' + rm -f path* .merge_* actual .git/index && + >path0123456789 && + git update-index --add path0123456789 && + ( + cd asubdir && + git checkout-index --temp -- ../path0123456789 >actual && + test_line_count = 1 actual && + test $(cut "-d " -f2 actual) = ../path0123456789 + ) +' + test_done -- 2.2.1.267.g0ad48de -- 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 5/5] checkout-index: fix --temp relative path mangling
checkout-index --temp only properly prints relative paths which are descendants of the current directory. Paths in ancestor or sibling directories (or their children) are often printed in mangled form. For example: mkdir a bbb && >file && >bbb/file && git update-index --add file bbb/file && cd a && git checkout-index --temp ../file ../bbb/file prints: .merge_file_ooblek le .merge_file_igloo0 b/file rather than the correct: .merge_file_ooblek ../file .merge_file_igloo0 ../bbb/file Internally, given the above example, checkout-index prefixes each input argument with the name of the current directory ("a/", in this case), and then assumes that it can simply skip forward by strlen("a/") bytes to recover the original name. This works for files in the current directory or its descendants, but fails for files in ancestors or siblings (or their children) due to path normalization. For instance, given "../file", "a/" is appended, giving "a/../file". Path normalization folds out "a/../", resulting in "file". Attempting to recover the original name by skipping strlen("a/") bytes gives the incorrect "le" rather than the desired "../file". Fix this by taking advantage of write_name_quoted_relative() to recover the original name properly, rather than assuming that it can be recovered by skipping strlen(prefix) bytes. As a bonus, this also fixes a bug in which checkout-index --temp accessed and printed memory beyond the end-of-string. For instance, within a subdirectory named "subdirectory", and given argument "../file", prefixing would give "subdirectory/../file", which would become "file" after normalization. checkout-index would then attempt to recover the original name by skipping strlen("subdirectory/") bytes of "file", which placed it well beyond end-of-string. Despite this error, it often appeared to give the correct result, but only due to an accident of implementation which left an apparently correct copy of the path in memory following the normalized value. In particular, handed "subdirectory/../file", in-place processing by normalize_path_copy_len() resulted in "file\0rectory/../file". When checkout-index skipped strlen("subdirectory/") bytes, it ended up back at "../file" and thus appeared to give the correct answer, despite being past end-of-string. Reported-by: Russ Cox Signed-off-by: Eric Sunshine --- builtin/checkout-index.c | 16 t/t2004-checkout-cache-temp.sh | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 383dccf..031780f 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -18,7 +18,7 @@ static char topath[4][TEMPORARY_FILENAME_LENGTH + 1]; static struct checkout state; -static void write_tempfile_record(const char *name, int prefix_length) +static void write_tempfile_record(const char *name, const char *prefix) { int i; @@ -35,14 +35,14 @@ static void write_tempfile_record(const char *name, int prefix_length) fputs(topath[checkout_stage], stdout); putchar('\t'); - write_name_quoted(name + prefix_length, stdout, line_termination); + write_name_quoted_relative(name, prefix, stdout, line_termination); for (i = 0; i < 4; i++) { topath[i][0] = 0; } } -static int checkout_file(const char *name, int prefix_length) +static int checkout_file(const char *name, const char *prefix) { int namelen = strlen(name); int pos = cache_name_pos(name, namelen); @@ -71,7 +71,7 @@ static int checkout_file(const char *name, int prefix_length) if (did_checkout) { if (to_tempfile) - write_tempfile_record(name, prefix_length); + write_tempfile_record(name, prefix); return errs > 0 ? -1 : 0; } @@ -106,7 +106,7 @@ static void checkout_all(const char *prefix, int prefix_length) if (last_ce && to_tempfile) { if (ce_namelen(last_ce) != ce_namelen(ce) || memcmp(last_ce->name, ce->name, ce_namelen(ce))) - write_tempfile_record(last_ce->name, prefix_length); + write_tempfile_record(last_ce->name, prefix); } if (checkout_entry(ce, &state, to_tempfile ? topath[ce_stage(ce)] : NULL) < 0) @@ -114,7 +114,7 @@ static void checkout_all(const char *prefix, int prefix_length) last_ce = ce; } if (last_ce && to_tempfile) - write_tempfile_record(last_ce->name, prefix_length); + write_tempfile_record(last_ce->name, prefix); if (errs) /* we have already done our error reporting. * exit with the same code as die(). @@ -248,7 +248,7 @@ int cmd_checkout_index(int argc, const char **argv, const
[PATCH 3/5] t2004: standardize file naming in symlink test
Update "symlink" test to use the common file naming scheme so that its temporary files can be cleaned up by the "rm -f path*" idiom employed by other tests in this script. Signed-off-by: Eric Sunshine --- t/t2004-checkout-cache-temp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh index 22d1a24..602fbc7 100755 --- a/t/t2004-checkout-cache-temp.sh +++ b/t/t2004-checkout-cache-temp.sh @@ -197,13 +197,13 @@ test_expect_success 'checkout --temp within subdir' ' test_expect_success 'checkout --temp symlink' ' rm -f path* .merge_* actual .git/index && - test_ln_s_add b a && + test_ln_s_add path7 path6 && git checkout-index --temp -a >actual && test_line_count = 1 actual && - test $(cut "-d " -f2 actual) = a && + test $(cut "-d " -f2 actual) = path6 && p=$(cut "-d " -f1 actual) && test -f $p && - test $(cat $p) = b + test $(cat $p) = path7 ' test_done -- 2.2.1.267.g0ad48de -- 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/5] t2004: drop unnecessary write-tree/read-tree
Unlike earlier tests which reference several trees prepared by "setup", no other tests utilize the tree from the "symlink" test, so there is no need to write it (or read it back immediately). Signed-off-by: Eric Sunshine --- t/t2004-checkout-cache-temp.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh index 28e50d6..22d1a24 100755 --- a/t/t2004-checkout-cache-temp.sh +++ b/t/t2004-checkout-cache-temp.sh @@ -198,9 +198,6 @@ test_expect_success 'checkout --temp within subdir' ' test_expect_success 'checkout --temp symlink' ' rm -f path* .merge_* actual .git/index && test_ln_s_add b a && - t4=$(git write-tree) && - rm -f .git/index && - git read-tree $t4 && git checkout-index --temp -a >actual && test_line_count = 1 actual && test $(cut "-d " -f2 actual) = a && -- 2.2.1.267.g0ad48de -- 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
"Stash save" exits with 0 when nothing to stash
Hi, When calling "git stash save" in a clean situation (no change since last commit), git-stash reports "No local changes to save", which is OK. But it exits with code 0, despite no stash has been saved. It would be better to exit with code 1 in this case. N.B. In a similar situation "git commit -a -m 'Test'" reports > On branch master > nothing to commit, working directory clean and exits with code 1. Thanks diff -u git-master/git-stash.sh exit1/git-stash.sh --- git-master/git-stash.sh 2014-12-22 20:43:48.0 + +++ exit1/git-stash.sh 2014-12-24 08:59:00.804150443 + @@ -257,7 +257,7 @@ if no_changes then say "$(gettext "No local changes to save")" - exit 0 + exit 1 fi test -f "$GIT_DIR/logs/$ref_stash" || clear_stash || die "$(gettext "Cannot initialize stash")" -- 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 5/5] engine.pl: provide more debug print statements
Assist developers transitioning between the two cultures by including appropriate, but commented out, debug statements. This acts as a poor man's --verbose option. The test suite doesn't cover the contrib/buildsystems (or Msysgit's msvc-build) contributions so fails to notice breakages there-in. Signed-off-by: Philip Oakley --- contrib/buildsystems/engine.pl | 4 1 file changed, 4 insertions(+) diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl index e913280..24a4c61 100755 --- a/contrib/buildsystems/engine.pl +++ b/contrib/buildsystems/engine.pl @@ -41,6 +41,7 @@ EOM # Parse command-line options while (@ARGV) { my $arg = shift @ARGV; + #print "Arg: $arg \n"; if ("$arg" eq "-h" || "$arg" eq "--help" || "$arg" eq "-?") { showUsage(); exit(0); @@ -123,6 +124,7 @@ sub parseMakeOutput print "Parsing GNU Make output to figure out build structure...\n"; my $line = 0; while (my $text = shift @makedry) { + #print "Make: $text\n"; # show the makedry line my $ate_next; do { $ate_next = 0; @@ -257,6 +259,7 @@ sub handleCompileLine } elsif ($part =~ /\.(c|cc|cpp)$/) { $sourcefile = $part; } else { +print "full line: $line\n"; die "Unhandled compiler option @ line $lineno: $part"; } } @@ -282,6 +285,7 @@ sub handleLibLine $libout = $part; $libout =~ s/\.a$//; } else { +print "full line: $line\n"; die "Unhandled lib option @ line $lineno: $part"; } } -- 2.1.0 -- 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 4/5] vcbuild/readme: Improve layout and reference msvc-build script
Layout the 'either/or' with more white space to clarify which alternatives are matched up. Reference the Msysgit build script which automates one sequence of options. Signed-off-by: Philip Oakley --- compat/vcbuild/README | 27 +++ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/compat/vcbuild/README b/compat/vcbuild/README index df8a657..7548dc4 100644 --- a/compat/vcbuild/README +++ b/compat/vcbuild/README @@ -3,20 +3,24 @@ The Steps of Build Git with VS2008 1. You need the build environment, which contains the Git dependencies to be able to compile, link and run Git with MSVC. - You can either use the binary repository: + You can either: + use the binary repository: WWW: http://repo.or.cz/w/msvcgit.git Git: git clone git://repo.or.cz/msvcgit.git Zip: http://repo.or.cz/w/msvcgit.git?a=snapshot;h=master;sf=zip - and call the setup_32bit_env.cmd batch script before compiling Git, - (see repo/package README for details), or the source repository: + and call the setup_32bit_env.cmd batch script before compiling Git, + (see repo/package README for details), + + or: + use the source repository: WWW: http://repo.or.cz/w/gitbuild.git Git: git clone git://repo.or.cz/gitbuild.git Zip: (None, as it's a project with submodules) - and build the support libs as instructed in that repo/package. + and build the support libs as instructed in that repo/package. 2. Ensure you have the msysgit environment in your path, so you have GNU Make, bash and perl available. @@ -33,18 +37,25 @@ The Steps of Build Git with VS2008 make common-cmds.h to generate the common-cmds.h file needed to compile git. -4. Then either build Git with the GNU Make Makefile in the Git projects - root +4. Then either + + build Git with the GNU Make Makefile in the Git projects root make MSVC=1 - or generate Visual Studio solution/projects (.sln/.vcproj) with the + or + + generate Visual Studio solution/projects (.sln/.vcproj) with the command perl contrib/buildsystems/generate -g Vcproj and open and build the solution with the IDE devenv git.sln /useenv - or build with the IDE build engine directly from the command line + or + + build with the IDE build engine directly from the command line devenv git.sln /useenv /build "Release|Win32" The /useenv option is required, so Visual Studio picks up the environment variables for the support libraries required to build Git, which you set up in step 1. Done! + +Or, use the Msysgit msvc-build script; available from that project. -- 2.1.0 -- 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/5] engine.pl: Fix i18n -o option in msvc buildsystem generator
The i18n 5e9637c (i18n: add infrastructure for translating Git with gettext, 2011-11-18) introduced an extra '-o' option into the make file, which broke engine.pl code for extracting the git.sln for msvc gui-IDE. Add tests to remove these non linker options, in same vein as 74cf9bd (engine.pl: Fix a recent breakage of the buildsystem generator, 2010-01-22). Signed-off-by: Philip Oakley --- contrib/buildsystems/engine.pl | 6 ++ 1 file changed, 6 insertions(+) diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl index 23da787..f48c28a 100755 --- a/contrib/buildsystems/engine.pl +++ b/contrib/buildsystems/engine.pl @@ -140,6 +140,12 @@ sub parseMakeOutput next; } +if ($text =~ /^(mkdir|msgfmt) /) { +# options to the Portable Object translations +# the line "mkdir ... && msgfmt ..." contains no linker options +next; +} + if($text =~ / -c /) { # compilation handleCompileLine($text, $line); -- 2.1.0 -- 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/5] engine.pl: Properly accept quoted spaces in filenames
The engine.pl script barfs on the properly quoted spaces in filename options prevalent on Windows. Use shellwords() rather than split() to separate such options. Signed-off-by: Philip Oakley --- contrib/buildsystems/engine.pl | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl index f48c28a..7f45b80 100755 --- a/contrib/buildsystems/engine.pl +++ b/contrib/buildsystems/engine.pl @@ -12,6 +12,7 @@ use File::Basename; use File::Spec; use Cwd; use Generators; +use Text::ParseWords; my (%build_structure, %compile_options, @makedry); my $out_dir = getcwd(); @@ -237,7 +238,7 @@ sub removeDuplicates sub handleCompileLine { my ($line, $lineno) = @_; -my @parts = split(' ', $line); +my @parts = shellwords($line); my $sourcefile; shift(@parts); # ignore cmd while (my $part = shift @parts) { @@ -271,7 +272,7 @@ sub handleLibLine my (@objfiles, @lflags, $libout, $part); # kill cmd and rm 'prefix' $line =~ s/^rm -f .* && .* rcs //; -my @parts = split(' ', $line); +my @parts = shellwords($line); while ($part = shift @parts) { if ($part =~ /^-/) { push(@lflags, $part); @@ -312,7 +313,7 @@ sub handleLinkLine { my ($line, $lineno) = @_; my (@objfiles, @lflags, @libs, $appout, $part); -my @parts = split(' ', $line); +my @parts = shellwords($line); shift(@parts); # ignore cmd while ($part = shift @parts) { if ($part =~ /^-IGNORE/) { -- 2.1.0 -- 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 0/5] Fix the Visual Studio 2008 .sln generator
Potential Windows developers are likely to be using Visual Studio as their IDE. The tool stack required for Windows can be tortuous as it crosses the boundaries between platforms and philosophies. This patch series seeks to maintain the tools that could assist such developers. In particular, those tools that generate an initial Visual Studio project (.sln ) file. The .sln generator in contrib began to break when internationalisation introduced an extra -o option. This recently worsened with the addition of invalidcontinue.obj for 'improved POSIX compatibility'. I hacked a bit when I first attempted to use the VS IDE and noticed the i18n issue. I didn't completely solve all my issues because of further issues with VS2010 Express, so no patches were submitted at the time. Now, with a fresh copy of VS20008 Express, I saw the additional problem of the addition of the invalidcontinue.obj reference causing the .sln generation to fail. The series has been tested against both recent git/git and msysgit/git. Both produce good VS2008 .sln project files though only msysgit/git compiles without error, both using the msysgit msvc-build script. Those compile errors are not related to this patch series. An initial RFC version was discussed on the msysgit list https://groups.google.com/forum/#!topic/msysgit/3MQ_NMNM390 or http://thread.gmane.org/gmane.comp.version-control.msysgit/21132. The final patch adds a poorman's --verbose by a few carefully selected commented out debug print statements to assist others in resolving future breakages. I've cc'd those who have contributed or patched the engine.pl, or appear to be interested via a $gmane search, who can hopefully comment. Philip Oakley (5): engine.pl: Fix i18n -o option in msvc buildsystem generator engine.pl: Properly accept quoted spaces in filenames engine.pl: ignore invalidcontinue.obj which is known to MSVC vcbuild/readme: Improve layout and reference msvc-build script engine.pl: provide more debug print statements compat/vcbuild/README | 27 +++ contrib/buildsystems/engine.pl | 27 +-- 2 files changed, 40 insertions(+), 14 deletions(-) -- 2.1.0 -- 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 3/5] engine.pl: ignore invalidcontinue.obj which is known to MSVC
Commit 4b623d8 (MSVC: link in invalidcontinue.obj for better POSIX compatibility, 2014-03-29) is not processed correctly by the buildsystem. Ignore it. Also split the .o and .obj processing; 'make' does not produce .obj files. Only substitute filenames ending with .o when generating the source .c filename. Signed-off-by: Philip Oakley --- contrib/buildsystems/engine.pl | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl index 7f45b80..e913280 100755 --- a/contrib/buildsystems/engine.pl +++ b/contrib/buildsystems/engine.pl @@ -289,7 +289,7 @@ sub handleLibLine #exit(1); foreach (@objfiles) { my $sourcefile = $_; -$sourcefile =~ s/\.o/.c/; +$sourcefile =~ s/\.o$/.c/; push(@sources, $sourcefile); push(@cflags, @{$compile_options{"${sourcefile}_CFLAGS"}}); push(@defines, @{$compile_options{"${sourcefile}_DEFINES"}}); @@ -333,8 +333,12 @@ sub handleLinkLine } elsif ($part =~ /\.(a|lib)$/) { $part =~ s/\.a$/.lib/; push(@libs, $part); -} elsif ($part =~ /\.(o|obj)$/) { +} elsif ($part eq 'invalidcontinue.obj') { +# ignore - known to MSVC +} elsif ($part =~ /\.o$/) { push(@objfiles, $part); +} elsif ($part =~ /\.obj$/) { +# do nothing, 'make' should not be producing .obj, only .o files } else { die "Unhandled lib option @ line $lineno: $part"; } @@ -343,7 +347,7 @@ sub handleLinkLine #exit(1); foreach (@objfiles) { my $sourcefile = $_; -$sourcefile =~ s/\.o/.c/; +$sourcefile =~ s/\.o$/.c/; push(@sources, $sourcefile); push(@cflags, @{$compile_options{"${sourcefile}_CFLAGS"}}); push(@defines, @{$compile_options{"${sourcefile}_DEFINES"}}); -- 2.1.0 -- 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
Cygwin sparse checkout degrades performance
Counter-intuitively, using sparse checkout in Cygwin degrades "status" times as status appears to "stat" non-existent files and directories. To demonstrate, I created a repo with 100k random files in a dir/dir/dir/file structure (on a linux box -- to do this in Cygwin requires piping the result of "openssl rand" to "dos2unix" as the output contains "\r") and cloned in a Cygwin shell: git init test cd test git commit --allow-empty -m 'Empty first commit' for i in {1..10}; do for j in {1..1}; do file=$( openssl rand -hex 32 | sed 's,^\(.\)\(.\)\(.\),\1/\2/\3/,'); mkdir -p $( dirname $file ); echo $file > $file ; done & done; wait git add . git commit -m '10 files' git gc --prune=now --aggressive I then timed and plotted "git status" as sparse checkout step-wisely reduced the number of files in the working tree using the folllowing command: ( ( git status >& /dev/null; time -p git status > /dev/null ) |& sed -n '/real/{s/real/10/p}'; git config core.sparseCheckout true; for i in $( seq 9 -1 1 ) 1; do git ls-files | head -n $i | sed 's,^,/,' > .git/info/sparse-checkout; git read-tree -u -m HEAD; git status >& /dev/null; ( time -p git status > /dev/null ) |& sed -n "/real/{s/real/$i/p}"; done; echo '*' > .git/info/sparse-checkout; git read-tree -u -m HEAD; rm .git/info/sparse-checkout; git config --unset core.sparseCheckout ) | gnuplot -p -e "set terminal dumb; set xrange[] reverse; set style data dots; set nokey; plot '-' using 1:2" Vertical bar is time in seconds, horizontal the number of files in the working tree after the sparse checkout. Linux results (v2.1.0): 0.45 .+-+--+-+--+--+--+--+-+--+-++ + + + + + + + + + + + | | 0.4 ++ ++ | | 0.35 ++ ++ | | | | 0.3 ++ . ++ | | | . | 0.25 ++ . . ++ | . . | | | 0.2 ++ . .++ | | 0.15 ++ . +. | | + + + + + + + + + + + 0.1 ++-+--+-+--+--+--+--+-+--+-++ 10 9 8 7 6 5 4 3 2 10 Cygwin results (v2.1.1): 10 ++-+--+--+--+--+--+--+--+--+-++ + + + + + + + + + + + | . 9 ++ ++ | . | | | 8 ++ .++ | | | | 7 ++ . ++ | | | | | . . | 6 ++ ++ | | | | 5 ++ . ++ .. . | + + . + + + + + + + + 4 ++-+--+--+--+--+--+--+--+--+-++ 10 9 8 7 6 5 4 3 2 10 Linux times do what I expect/want (they get better as the number of working tree files decrease), but Cygwin does the opposite: the worst times are in a working tree with only 1 (sparse) file, and it's double where I started with no sparse checkout! I'd hoped sparse checkout would improve the too-slow status times when all files are present... Looking at strace with a working tree consisting of a single (sparse) file suggests Cygwin is attempting to access the non-existent files and directories whereas Linux does not appear to do so. In fact, if I do nothing more than "mkdir -p $( git ls-files | cut -c1-5 | sort -u )" when looking at a single (sparse) file, I can drop status times below 3s, a 3-fold improvement and something at least better than where I started! Is there a way I can get improved status times using sparse checkout with Cygwin? -- 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: Cygwin sparse checkout degrades performance
Huh. The graphs (somehow) ended up incoherently reformatted... Sorry about that! Here's the raw data after a second run: Linux: 10 0.49 9 0.27 8 0.27 7 0.28 6 0.23 5 0.21 4 0.21 3 0.19 2 0.19 1 0.16 1 0.14 Cygwin: 10 4.72 9 4.28 8 4.41 7 4.43 6 4.67 5 5.04 4 6.24 3 7.28 2 7.88 1 8.96 1 9.43 On 12/24/2014 12:30 PM, Brian Ericson wrote: Counter-intuitively, using sparse checkout in Cygwin degrades "status" times as status appears to "stat" non-existent files and directories. To demonstrate, I created a repo with 100k random files in a dir/dir/dir/file structure (on a linux box -- to do this in Cygwin requires piping the result of "openssl rand" to "dos2unix" as the output contains "\r") and cloned in a Cygwin shell: git init test cd test git commit --allow-empty -m 'Empty first commit' for i in {1..10}; do for j in {1..1}; do file=$( openssl rand -hex 32 | sed 's,^\(.\)\(.\)\(.\),\1/\2/\3/,'); mkdir -p $( dirname $file ); echo $file > $file ; done & done; wait git add . git commit -m '10 files' git gc --prune=now --aggressive I then timed and plotted "git status" as sparse checkout step-wisely reduced the number of files in the working tree using the folllowing command: ( ( git status >& /dev/null; time -p git status > /dev/null ) |& sed -n '/real/{s/real/10/p}'; git config core.sparseCheckout true; for i in $( seq 9 -1 1 ) 1; do git ls-files | head -n $i | sed 's,^,/,' > .git/info/sparse-checkout; git read-tree -u -m HEAD; git status >& /dev/null; ( time -p git status > /dev/null ) |& sed -n "/real/{s/real/$i/p}"; done; echo '*' > .git/info/sparse-checkout; git read-tree -u -m HEAD; rm .git/info/sparse-checkout; git config --unset core.sparseCheckout ) | gnuplot -p -e "set terminal dumb; set xrange[] reverse; set style data dots; set nokey; plot '-' using 1:2" Vertical bar is time in seconds, horizontal the number of files in the working tree after the sparse checkout. Linux results (v2.1.0): 0.45 .+-+--+-+--+--+--+--+-+--+-++ + + + + + + + + + + + | | 0.4 ++ ++ | | 0.35 ++ ++ | | | | 0.3 ++ . ++ | | | . | 0.25 ++ . . ++ | . . | | | 0.2 ++ . .++ | | 0.15 ++ . +. | | + + + + + + + + + + + 0.1 ++-+--+-+--+--+--+--+-+--+-++ 10 9 8 7 6 5 4 3 2 10 Cygwin results (v2.1.1): 10 ++-+--+--+--+--+--+--+--+--+-++ + + + + + + + + + + + | . 9 ++ ++ | . | | | 8 ++ .++ | | | | 7 ++ . ++ | | | | | . . | 6 ++ ++ | | | | 5 ++ . ++ .. . | + + . + + + + + + + + 4 ++-+--+--+--+--+--+--+--+--+-++ 10 9 8 7 6 5 4 3 2 10 Linux times do what I expect/want (they get better as the number of working tree files decrease), but Cygwin does the opposite: the worst times are in a working tree with only 1 (sparse) file, and it's double where I started with no sparse checkout! I'd hoped sparse checkout would improve the too-slow status times when all files are present... Looking at strace with a working tree consisting of a single (sparse) file suggests Cygwin is attempting to access the non-existent files and directories whereas Linux does not appear to do so. In fact, if I do nothing more than "mkdir -p $( git ls-files | cut -c1-5 | sort -u )" when looking at a single (sparse) file, I can drop status times below 3s, a 3-fold improvement and something at least better than where I started! Is there a way I can get improved status times using sparse checkout with Cygwin? -- 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 . -- 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 v6 1/1] http: Add Accept-Language header if possible
On Mon, Dec 22, 2014 at 11:44 AM, Yi EungJun wrote: > From: Yi EungJun > > Add an Accept-Language header which indicates the user's preferred > languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. > > Examples: > LANGUAGE= -> "" > LANGUAGE=ko:en -> "Accept-Language: ko, en;q=0.9, *;q=0.1" > LANGUAGE=ko LANG=en_US.UTF-8 -> "Accept-Language: ko, *;q=0.1" > LANGUAGE= LANG=en_US.UTF-8 -> "Accept-Language: en-US, *;q=0.1" > > This gives git servers a chance to display remote error messages in > the user's preferred language. > > Limit the number of languages to 1,000 because q-value must not be > smaller than 0.001, and limit the length of Accept-Language header to > 4,000 bytes for some HTTP servers which cannot accept such long header. Just a few comments and observations below. Alone, they are not necessarily worth a re-roll, but if you happen to re-roll for some other reason, perhaps take them into consideration. > Signed-off-by: Yi EungJun > --- > diff --git a/http.c b/http.c > index 040f362..7a77708 100644 > --- a/http.c > +++ b/http.c > @@ -986,6 +993,166 @@ static void extract_content_type(struct strbuf *raw, > struct strbuf *type, > strbuf_addstr(charset, "ISO-8859-1"); > } > > +static void write_accept_language(struct strbuf *buf) > +{ > + [...] > + /* > +* MAX_LANGS must not be larger than 1,000. If it is larger than that, > +* q-value will be smaller than 0.001, the minimum q-value the HTTP > +* specification allows [1]. > +* > +* [1]: http://tools.ietf.org/html/rfc7231#section-5.3.1 > +*/ > + const int MAX_LANGS = 1000; > + const int MAX_SIZE_OF_HEADER = 4000; > + const int MAX_SIZE_OF_ASTERISK_ELEMENT = 11; /* for ", *;q=0.001" */ These two MAX_SIZE_* constants are never used individually, but rather only as (MAX_SIZE_OF_HEADER - MAX_SIZE_OF_ASTERISK_ELEMENT). It might be a bit more readable to compute the final value here, with a suitable comment, rather than at point-of-use. Perhaps something like: /* limit of some HTTP servers is 4000 - strlen(", *;q=0.001") */ const int MAX_HEADER_SIZE = 4000 - 11; More below. > + [...] > + /* > +* Convert a list of colon-separated locale values [1][2] to a list of > +* comma-separated language tags [3] which can be used as a value of > +* Accept-Language header. > + [...] > +*/ > + for (pos = lang_begin; ; pos++) { > + if (!*pos || *pos == ':') { > + if (is_q_factor_required) { > + /* Put a q-factor only if it is less than > 1.0. */ > + if (q < max_q) > + strbuf_addf(buf, q_format, q); > + > + if (q > 1) > + q--; > + > + last_size = buf->len; > + > + is_q_factor_required = 0; > + } > + parse_state = SEPARATOR; > + } else if (parse_state == CODESET_OR_MODIFIER) > + continue; > + else if (*pos == ' ') /* Ignore whitespace character */ > + continue; > + else if (*pos == '.' || *pos == '@') /* Remove .codeset and > @modifier. */ > + parse_state = CODESET_OR_MODIFIER; > + else { > + if (parse_state != LANGUAGE_TAG && q < max_q) > + strbuf_addstr(buf, ", "); > + strbuf_addch(buf, *pos == '_' ? '-' : *pos); > + is_q_factor_required = 1; > + parse_state = LANGUAGE_TAG; > + } > + > + if (buf->len > MAX_SIZE_OF_HEADER - > MAX_SIZE_OF_ASTERISK_ELEMENT) { > + strbuf_remove(buf, last_size, buf->len - last_size); > + break; > + } > + > + if (!*pos) > + break; > + } Although often suitable when parsing complex inputs, state machines demand high cognitive load. The input you're parsing, on the other hand, is straightforward and can easily be processed with a simple sequential parser, which is easier to reason about and review for correctness. For instance, something like this: while (*s) { /* collect language tag */ for (; *s && *s != '.' && *s != '@' && *s != ':'; s++) strbuf_addch(buf, *s == '_' ? '-' : *s); /* skip .codeset and @modifier */ while (*s && *s != ':') s++; strbuf_addf(buf, q_format, q); ... other bookkeeping ... if (*s == ':') s++; } This example is intentionally simplified but illustrates the general idea. It lacks comma insertion (left as an exercise for the reader) and empty language tag handling (":en", "en::ko"); and d
Upgrade Git in openSUSE13.1
Hi, I am keep getting the below warning, whenever I am trying to deploy my code there : [arup@to_do_app]$ heroku logs -t Your version of git is 1.8.4.5. Which has serious security vulnerabilities. More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x 2014-12-21T17:58:49.605785+00:00 app[web.1]:from /app/vendor/bundle/ruby/2.1.0/gems/dm-migrations-1.2.0/lib/dm- migrations/adapters/dm-postgres-adapter.rb:60:in `ensure in without_notices' I am also not seeing any upgrade here - http://software.opensuse.org/package/git How to upgrade then ? -- Regards, Arup Rakshit Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. --Brian Kernighan -- 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 v3 2/4] rev-list: add an option to mark fewer edges as uninteresting
On Tue, Dec 23, 2014 at 01:51:42PM -0500, Jeff King wrote: > On Tue, Dec 23, 2014 at 12:55:48PM -0500, Michael Blume wrote: > > > This patch causes an error on my mac, test 5500 fetch-pack errors on > > part 44 - fetch creating new shallow root. It looks for "remote: Total > > 1" in the fetch output and gets 3 instead. > > It fails for me on Linux, too. Interestingly the tip of the series > passes. I didn't investigate further. Yes, the tip of the series fixes that issue. I had trouble coming up with a good technique to split the patches in a way such that they were logically distinct yet addressed the failure. I had an epiphany on how to do that last night, so I'll reroll sometime today. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
Re: [PATCH v3 0/4] Improve push performance with lots of refs
On Tue, Dec 23, 2014 at 10:40:54AM -0800, Junio C Hamano wrote: > You spell "--thin-aggressive" as two words, "--thin" "--shallow", in > this series, essentially, no? Essentially, yes. It became obligatory after I noticed the test failure, since that test actually checks whether the remote side sends a shallow-optimized pack. > I think this is going in the right direction. The "shallow" > propagated on the wire from the fetcher is the right thing to use > to make this decision. > > I wonder if the call to is_repository_shallow() is still necessary > (read: I would prefer to see it go away) where we decide between > "--objects-edge" and "--objects-edge-aggressive". Okay. I'll try to push it up the stack a little bit. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187 signature.asc Description: Digital signature
[PATCH v4 0/3] Improve push performance with lots of refs
This series contains patches to address a significant push performance regression in repositories with large amounts of refs. It avoids performing expensive edge marking unless the repository is shallow. The first patch in the series is a fix for a minor typo I discovered when editing the documentation. The second patch implements git rev-list --objects-edge-aggressive, and the third patch ensures it's used for pushing to and fetching from shallow repos only. The changes from v3 are to use --objects-edge-aggressive from the point it's introduced (this preserves bisectability) and to make higher-level commands pass --shallow for any shallow pushing and fetching instead of trying to have pack-objects determine it. The original fix was suggested by Duy Nguyen. brian m. carlson (3): Documentation: add missing article in rev-list-options.txt rev-list: add an option to mark fewer edges as uninteresting pack-objects: use --objects-edge-aggressive for shallow repos Documentation/git-pack-objects.txt | 7 ++- Documentation/git-rev-list.txt | 3 ++- Documentation/rev-list-options.txt | 7 ++- builtin/pack-objects.c | 7 ++- list-objects.c | 4 ++-- revision.c | 6 ++ revision.h | 1 + send-pack.c| 3 +++ upload-pack.c | 4 +++- 9 files changed, 35 insertions(+), 7 deletions(-) -- 2.2.1.209.g41e5f3a -- 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 v4 2/3] rev-list: add an option to mark fewer edges as uninteresting
In commit fbd4a70 (list-objects: mark more commits as edges in mark_edges_uninteresting - 2013-08-16), we marked an increasing number of edges uninteresting. This change, and the subsequent change to make this conditional on --objects-edge, are used by --thin to make much smaller packs for shallow clones. Unfortunately, they cause a significant performance regression when pushing non-shallow clones with lots of refs (23.322 seconds vs. 4.785 seconds with 22400 refs). Add an option to git rev-list, --objects-edge-aggressive, that preserves this more aggressive behavior, while leaving --objects-edge to provide more performant behavior. Preserve the current behavior for the moment by using the aggressive option. Signed-off-by: brian m. carlson --- Documentation/git-rev-list.txt | 3 ++- Documentation/rev-list-options.txt | 4 builtin/pack-objects.c | 2 +- list-objects.c | 4 ++-- revision.c | 6 ++ revision.h | 1 + 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt index fd7f8b5..5b11922 100644 --- a/Documentation/git-rev-list.txt +++ b/Documentation/git-rev-list.txt @@ -46,7 +46,8 @@ SYNOPSIS [ \--extended-regexp | -E ] [ \--fixed-strings | -F ] [ \--date=(local|relative|default|iso|iso-strict|rfc|short) ] -[ [\--objects | \--objects-edge] [ \--unpacked ] ] +[ [ \--objects | \--objects-edge | \--objects-edge-aggressive ] + [ \--unpacked ] ] [ \--pretty | \--header ] [ \--bisect ] [ \--bisect-vars ] diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 2277fcb..8cb6f92 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -657,6 +657,10 @@ These options are mostly targeted for packing of Git repositories. objects in deltified form based on objects contained in these excluded commits to reduce network traffic. +--objects-edge-aggressive:: + Similar to `--objects-edge`, but it tries harder to find excluded + commits at the cost of increased time. + --unpacked:: Only useful with `--objects`; print the object IDs that are not in packs. diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 3f9f5c7..f93a17c 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2711,7 +2711,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) argv_array_push(&rp, "pack-objects"); if (thin) { use_internal_rev_list = 1; - argv_array_push(&rp, "--objects-edge"); + argv_array_push(&rp, "--objects-edge-aggressive"); } else argv_array_push(&rp, "--objects"); diff --git a/list-objects.c b/list-objects.c index 2910bec..2a139b6 100644 --- a/list-objects.c +++ b/list-objects.c @@ -157,7 +157,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge) if (commit->object.flags & UNINTERESTING) { mark_tree_uninteresting(commit->tree); - if (revs->edge_hint && !(commit->object.flags & SHOWN)) { + if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) { commit->object.flags |= SHOWN; show_edge(commit); } @@ -165,7 +165,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge) } mark_edge_parents_uninteresting(commit, revs, show_edge); } - if (revs->edge_hint) { + if (revs->edge_hint_aggressive) { for (i = 0; i < revs->cmdline.nr; i++) { struct object *obj = revs->cmdline.rev[i].item; struct commit *commit = (struct commit *)obj; diff --git a/revision.c b/revision.c index 75dda92..753dd2f 100644 --- a/revision.c +++ b/revision.c @@ -1853,6 +1853,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->tree_objects = 1; revs->blob_objects = 1; revs->edge_hint = 1; + } else if (!strcmp(arg, "--objects-edge-aggressive")) { + revs->tag_objects = 1; + revs->tree_objects = 1; + revs->blob_objects = 1; + revs->edge_hint = 1; + revs->edge_hint_aggressive = 1; } else if (!strcmp(arg, "--verify-objects")) { revs->tag_objects = 1; revs->tree_objects = 1; diff --git a/revision.h b/revision.h index 9cb5adc..033a244 100644 --- a/revision.h +++ b/revision.h @@ -93,6 +93,7 @@ struct rev_info { blob_objects:1, verify_objects:1,
[PATCH v4 3/3] pack-objects: use --objects-edge-aggressive for shallow repos
When fetching into or pushing from a shallow repository, we want to aggressively mark edges as uninteresting, since this decreases the pack size. However, aggressively marking edges can negatively affect performance on large non-shallow repositories with lots of refs. Teach pack-objects a --shallow option to indicate that we're pushing from or fetching into a shallow repository. Use --objects-edge-aggressive only for shallow repositories and otherwise use --objects-edge, which performs better in the general case. Update the callers to pass the --shallow option when they are dealing with a shallow repository. Signed-off-by: brian m. carlson --- Documentation/git-pack-objects.txt | 7 ++- Documentation/rev-list-options.txt | 3 ++- builtin/pack-objects.c | 7 ++- send-pack.c| 3 +++ upload-pack.c | 4 +++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt index d2d8f47..c2f76fb 100644 --- a/Documentation/git-pack-objects.txt +++ b/Documentation/git-pack-objects.txt @@ -13,7 +13,7 @@ SYNOPSIS [--no-reuse-delta] [--delta-base-offset] [--non-empty] [--local] [--incremental] [--window=] [--depth=] [--revs [--unpacked | --all]] [--stdout | base-name] - [--keep-true-parents] < object-list + [--shallow] [--keep-true-parents] < object-list DESCRIPTION @@ -190,6 +190,11 @@ required objects and is thus unusable by Git without making it self-contained. Use `git index-pack --fix-thin` (see linkgit:git-index-pack[1]) to restore the self-contained property. +--shallow:: + Optimize a pack that will be provided to a client with a shallow + repository. This option, combined with \--thin, can result in a + smaller pack at the cost of speed. + --delta-base-offset:: A packed archive can express the base object of a delta as either a 20-byte object name or as an offset in the diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 8cb6f92..2984f40 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -659,7 +659,8 @@ These options are mostly targeted for packing of Git repositories. --objects-edge-aggressive:: Similar to `--objects-edge`, but it tries harder to find excluded - commits at the cost of increased time. + commits at the cost of increased time. This is used instead of + `--objects-edge` to build ``thin'' packs for shallow repositories. --unpacked:: Only useful with `--objects`; print the object IDs that are not diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index f93a17c..d816587 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2613,6 +2613,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) { int use_internal_rev_list = 0; int thin = 0; + int shallow = 0; int all_progress_implied = 0; struct argv_array rp = ARGV_ARRAY_INIT; int rev_list_unpacked = 0, rev_list_all = 0, rev_list_reflog = 0; @@ -2677,6 +2678,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) PARSE_OPT_OPTARG, option_parse_unpack_unreachable }, OPT_BOOL(0, "thin", &thin, N_("create thin packs")), + OPT_BOOL(0, "shallow", &shallow, +N_("create packs suitable for shallow fetches")), OPT_BOOL(0, "honor-pack-keep", &ignore_packed_keep, N_("ignore packs that have companion .keep file")), OPT_INTEGER(0, "compression", &pack_compression_level, @@ -2711,7 +2714,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) argv_array_push(&rp, "pack-objects"); if (thin) { use_internal_rev_list = 1; - argv_array_push(&rp, "--objects-edge-aggressive"); + argv_array_push(&rp, shallow + ? "--objects-edge-aggressive" + : "--objects-edge"); } else argv_array_push(&rp, "--objects"); diff --git a/send-pack.c b/send-pack.c index 949cb61..25947d7 100644 --- a/send-pack.c +++ b/send-pack.c @@ -47,6 +47,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru NULL, NULL, NULL, + NULL, }; struct child_process po = CHILD_PROCESS_INIT; int i; @@ -60,6 +61,8 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru argv[i++] = "-q"; if (args->progress) argv[i++] = "--progress"; + if (is_repository_shallow()) + argv[i++] = "--shallow"; po.argv = argv; po.in = -1; po.out =
[PATCH v4 1/3] Documentation: add missing article in rev-list-options.txt
Add the missing article "a". Signed-off-by: brian m. carlson --- Documentation/rev-list-options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index afccfdc..2277fcb 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -653,7 +653,7 @@ These options are mostly targeted for packing of Git repositories. --objects-edge:: Similar to `--objects`, but also print the IDs of excluded commits prefixed with a ``-'' character. This is used by - linkgit:git-pack-objects[1] to build ``thin'' pack, which records + linkgit:git-pack-objects[1] to build a ``thin'' pack, which records objects in deltified form based on objects contained in these excluded commits to reduce network traffic. -- 2.2.1.209.g41e5f3a -- 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: Supporting a few more usecases with remote helpers
On Mon, Dec 22, 2014 at 10:07:26AM +0900, Mike Hommey wrote: > Hi, > > As you may or may not know, I'm working on a remote-helper to interact > with mercurial servers, with the main focus being to make it work with > developer workflows at Mozilla. > > I think remote-helpers, in the context of non-git remotes, can be > leveraged to improve git user experience with non-git remotes. > > - While git doesn't support this[1], mercurial allows to pull a specific > commit. That's quite commonly used at Mozilla. It makes it desirable > to be able to `git fetch origin sha1`, where sha1 could actually be > considered as fake head name. But that currently can't work because > only refs returned by the `list` command of the remote-helper are > considered, and we can't realistically list all the remote changesets > there. > - A lot of places (bug logs, CI, etc.) will list mercurial changesets > or, more commonly, their abbreviated form. It is quite common to look > at those locally. When using a git clone of a mercurial repository, > it adds a level of indirection where the user first needs a command to > resolve that mercurial changeset to the corresponding git commit, then > run whatever command they wanted to run with that git commit. This > could be worked around by adding e.g. tags for both abbreviated and > long form of the changesets, but we'd be looking at more than 400k > refs for a typical Mozilla repository. That doesn't quite scale. > - On the opposite side of the above, it can be necessary to find out > what mercurial changeset a git commit corresponds to, and while, like > the above, there can be a command to resolve those, that's a level > of indirection that is not very nice for users. > > Here's my thoughts on how I think this could be done, but before I dive > in the code to actually implement it, I'd like to get feedback whether > it makes sense. > > - I think the first and second use cases could both use the same > "feature". We could add a new `list` option to the remote-helpers > that would make it list a limited set of refs, and giving it the > opportunity to reply with heads it wouldn't give normally. For > example, this would look like this: > git fetch origin 7b33ee7fd162d784f382250d3fa811e86a1b7348 It turns out this command already works, because the given ref is a full sha1, and there's a special case for that. I'd like for the abbreviated form to work, though. > > list ref refs/heads/7b33ee7fd162d784f382250d3fa811e86a1b7348 > ? refs/heads/7b33ee7fd162d784f382250d3fa811e86a1b7348 > git show ba0dc109a8f8 > > list ref refs/heads/ba0dc109a8f8 > 1d1c70ecefa26e5fa859366ac989497843a3f8ff refs/heads/ba0dc109a8f8 > - For the latter, I was thinking the decorate code (for git log > --decorate) could request ref names to the remote-helper, like this: > > ref short 1d1c70ecefa26e5fa859366ac989497843a3f8ff > 1d1c70ecefa26e5fa859366ac989497843a3f8ff ba0dc109a8f8 > > ref full 1d1c70ecefa26e5fa859366ac989497843a3f8ff > 1d1c70ecefa26e5fa859366ac989497843a3f8ff > ba0dc109a8f86ca831866a5933cf863d379434cd > Then the decorate code would display helper-prefix::ba0dc109a8f8 or > helper-prefix::ba0dc109a8f86ca831866a5933cf863d379434cd depending on > the --decorate value. > > Calling remote-helpers for the above would be triggered by the presence > of one or more remotes with helper:: prefixed urls. > > Thoughts? > > Mike > > 1. I think it should, as long as the given sha1 is reachable from the > public heads, but that's offtopic here. -- 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: Upgrade Git in openSUSE13.1
go https://msysgit.github.io/ -- View this message in context: http://git.661346.n2.nabble.com/Upgrade-Git-in-openSUSE13-1-tp7623397p7623405.html Sent from the git mailing list archive at Nabble.com. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Upgrade Git in openSUSE13.1
or http://sourceforge.net/projects/git-osx-installer/files/ for OS X users see https://blog.heroku.com/archives/2014/12/24/update_your_git_clients_on_windows_and_os_x -- View this message in context: http://git.661346.n2.nabble.com/Upgrade-Git-in-openSUSE13-1-tp7623397p7623406.html Sent from the git mailing list archive at Nabble.com. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Upgrade Git in openSUSE13.1
On Thu, Dec 25, 2014 at 3:02 AM, Arup Rakshit wrote: > Hi, > > I am keep getting the below warning, whenever I am trying to deploy my code > there : > > [arup@to_do_app]$ heroku logs -t > Your version of git is 1.8.4.5. Which has serious security vulnerabilities. > More information here: > https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x > 2014-12-21T17:58:49.605785+00:00 app[web.1]:from > /app/vendor/bundle/ruby/2.1.0/gems/dm-migrations-1.2.0/lib/dm- > migrations/adapters/dm-postgres-adapter.rb:60:in `ensure in without_notices' > > I am also not seeing any upgrade here - > http://software.opensuse.org/package/git > > How to upgrade then ? OpenSUSE appears a bit slow in handling this CVE. Follow this bug for progress, status.. https://bugzilla.opensuse.org/show_bug.cgi?id=910756 -- 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