{"thread":{"id":"8780","subject":"[PATCH] GIT-VERSION-GEN: don't convert - delimiter to .'s","startedAt":"2007-06-30T08:56:11Z","lastAt":"2007-07-11T10:49:54Z","messageCount":37,"participants":["Sam Vilain","Frank Lichtenheld","Johannes Schindelin","Junio C Hamano","Matthias Lederhofer","Eric Wong","Nicolas Pitre","Shawn O. Pearce","Alex Riesen","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46080","messageId":"1183193781941-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":null,"subject":"a bunch of outstanding updates","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:11Z","receivedAt":"2007-06-30T08:56:11Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"\nFollowing up to this e-mail are a whole load of outstanding feature\nrequests of mine.\n\nThese changes are relatively mundane:\n\n    * repack: improve documentation on -a option\n    * git-remote: document -n\n    * git-remote: allow 'git-remote fetch' as a synonym for 'git fetch'\n    * git-svn: use git-log rather than rev-list | xargs cat-file\n    * git-svn: cache max revision in rev_db databases\n\nThis one will impact on the version displayed by \"git --version\", but\nI think this is for the better:\n\n    * GIT-VERSION-GEN: don't convert - delimiter to .'s\n\nThese ones are really only very minor updates based on feedback so\nfar:\n\n    * git-merge-ff: fast-forward only merge\n    * git-mergetool: add support for ediff\n\nThis one is just the previously posted hook script put into the\ntemplates directory, let me know if you'd rather I reshaped it to go\ninto contrib/hooks:\n\n    * contrib/hooks: add post-update hook for updating working copy\n\nThis one probably needs a bit more consideration and review, could\nperhaps sit on pu.\n\n    * git-repack: generational repacking (and example hook script)\n"},{"id":"46076","messageId":"11831937813223-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"1183193781941-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] repack: improve documentation on -a option","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:12Z","receivedAt":"2007-06-30T08:56:12Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Some minor enhancements to the git-repack manual page.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/git-repack.txt |   13 ++++++++-----\n 1 files changed, 8 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt\nindex c33a512..be8e5f8 100644\n--- a/Documentation/git-repack.txt\n+++ b/Documentation/git-repack.txt\n@@ -14,7 +14,8 @@ DESCRIPTION\n -----------\n \n This script is used to combine all objects that do not currently\n-reside in a \"pack\", into a pack.\n+reside in a \"pack\", into a pack.  It can also be used to re-organise\n+existing packs into a single, more efficient pack.\n \n A pack is a collection of objects, individually compressed, with\n delta compression applied, stored in a single file, with an\n@@ -28,11 +29,13 @@ OPTIONS\n \n -a::\n \tInstead of incrementally packing the unpacked objects,\n-\tpack everything available into a single pack.\n+\tpack everything referenced into a single pack.\n \tEspecially useful when packing a repository that is used\n-\tfor private development and there is no need to worry\n-\tabout people fetching via dumb file transfer protocols\n-\tfrom it.  Use with '-d'.\n+\tfor private development and there no need to worry\n+\tabout people fetching via dumb protocols from it.  Use\n+\twith '-d'.  This will clean up the objects that `git prune`\n+\tleaves behind, but `git fsck-objects --full` shows as\n+\tdangling.\n \n -d::\n \tAfter packing, if the newly created packs make some\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46075","messageId":"11831937822346-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937813223-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] git-svn: use git-log rather than rev-list | xargs cat-file","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:13Z","receivedAt":"2007-06-30T08:56:13Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nThis saves a bit of time when rebuilding the git-svn index.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n git-svn.perl |   36 ++++++++++++++++++++++--------------\n 1 files changed, 22 insertions(+), 14 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 3033b50..556cd7d 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -782,12 +782,12 @@ sub read_repo_config {\n \n sub extract_metadata {\n \tmy $id = shift or return (undef, undef, undef);\n-\tmy ($url, $rev, $uuid) = ($id =~ /^git-svn-id:\\s(\\S+?)\\@(\\d+)\n+\tmy ($url, $rev, $uuid) = ($id =~ /^\\s*git-svn-id:\\s+(.*)\\@(\\d+)\n \t\t\t\t\t\t\t\\s([a-f\\d\\-]+)$/x);\n \tif (!defined $rev || !$uuid || !$url) {\n \t\t# some of the original repositories I made had\n \t\t# identifiers like this:\n-\t\t($rev, $uuid) = ($id =~/^git-svn-id:\\s(\\d+)\\@([a-f\\d\\-]+)/);\n+\t\t($rev, $uuid) = ($id =~/^\\s*git-svn-id:\\s(\\d+)\\@([a-f\\d\\-]+)/);\n \t}\n \treturn ($url, $rev, $uuid);\n }\n@@ -799,10 +799,16 @@ sub cmt_metadata {\n \n sub working_head_info {\n \tmy ($head, $refs) = @_;\n-\tmy ($fh, $ctx) = command_output_pipe('rev-list', $head);\n-\twhile (my $hash = <$fh>) {\n-\t\tchomp($hash);\n-\t\tmy ($url, $rev, $uuid) = cmt_metadata($hash);\n+\tmy ($fh, $ctx) = command_output_pipe('log', $head);\n+\tmy $hash;\n+\twhile (<$fh>) {\n+\t\tif ( m{^commit ($::sha1)$} ) {\n+\t\t\tunshift @$refs, $hash if $hash and $refs;\n+\t\t\t$hash = $1;\n+\t\t\tnext;\n+\t\t}\n+\t\tnext unless s{^\\s*(git-svn-id:)}{$1};\n+\t\tmy ($url, $rev, $uuid) = extract_metadata($_);\n \t\tif (defined $url && defined $rev) {\n \t\t\tif (my $gs = Git::SVN->find_by_url($url)) {\n \t\t\t\tmy $c = $gs->rev_db_get($rev);\n@@ -812,7 +818,6 @@ sub working_head_info {\n \t\t\t\t}\n \t\t\t}\n \t\t}\n-\t\tunshift @$refs, $hash if $refs;\n \t}\n \tcommand_close_pipe($fh, $ctx);\n \t(undef, undef, undef, undef);\n@@ -2019,16 +2024,19 @@ sub rebuild {\n \t\treturn;\n \t}\n \tprint \"Rebuilding $db_path ...\\n\";\n-\tmy ($rev_list, $ctx) = command_output_pipe(\"rev-list\", $self->refname);\n+\tmy ($log, $ctx) = command_output_pipe(\"log\", $self->refname);\n \tmy $latest;\n \tmy $full_url = $self->full_url;\n \tremove_username($full_url);\n \tmy $svn_uuid;\n-\twhile (<$rev_list>) {\n-\t\tchomp;\n-\t\tmy $c = $_;\n-\t\tdie \"Non-SHA1: $c\\n\" unless $c =~ /^$::sha1$/o;\n-\t\tmy ($url, $rev, $uuid) = ::cmt_metadata($c);\n+\tmy $c;\n+\twhile (<$log>) {\n+\t\tif ( m{^commit ($::sha1)$} ) {\n+\t\t\t$c = $1;\n+\t\t\tnext;\n+\t\t}\n+\t\tnext unless s{^\\s*(git-svn-id:)}{$1};\n+\t\tmy ($url, $rev, $uuid) = ::extract_metadata($_);\n \t\tremove_username($url);\n \n \t\t# ignore merges (from set-tree)\n@@ -2046,7 +2054,7 @@ sub rebuild {\n \t\t$self->rev_db_set($rev, $c);\n \t\tprint \"r$rev = $c\\n\";\n \t}\n-\tcommand_close_pipe($rev_list, $ctx);\n+\tcommand_close_pipe($log, $ctx);\n \tprint \"Done rebuilding $db_path\\n\";\n }\n \n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46074","messageId":"11831937823184-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937822346-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] git-svn: cache max revision in rev_db databases","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:14Z","receivedAt":"2007-06-30T08:56:14Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nCache the maximum revision for each rev_db URL rather than looking it\nup each time.  This saves a lot of time when rebuilding indexes on a\nfreshly cloned repository.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n git-svn.perl |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 556cd7d..a8b6669 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -801,6 +801,7 @@ sub working_head_info {\n \tmy ($head, $refs) = @_;\n \tmy ($fh, $ctx) = command_output_pipe('log', $head);\n \tmy $hash;\n+\tmy %max;\n \twhile (<$fh>) {\n \t\tif ( m{^commit ($::sha1)$} ) {\n \t\t\tunshift @$refs, $hash if $hash and $refs;\n@@ -810,11 +811,14 @@ sub working_head_info {\n \t\tnext unless s{^\\s*(git-svn-id:)}{$1};\n \t\tmy ($url, $rev, $uuid) = extract_metadata($_);\n \t\tif (defined $url && defined $rev) {\n+\t\t\tnext if $max{$url} and $max{$url} < $rev;\n \t\t\tif (my $gs = Git::SVN->find_by_url($url)) {\n \t\t\t\tmy $c = $gs->rev_db_get($rev);\n \t\t\t\tif ($c && $c eq $hash) {\n \t\t\t\t\tclose $fh; # break the pipe\n \t\t\t\t\treturn ($url, $rev, $uuid, $gs);\n+\t\t\t\t} else {\n+\t\t\t\t\t$max{$url} ||= $gs->rev_db_max;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46071","messageId":"11831937823982-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937823184-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] GIT-VERSION-GEN: don't convert - delimiter to .'s","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:15Z","receivedAt":"2007-06-30T08:56:15Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Otherwise, a custom \"v1.5.2.42.gb1ff\" is considered newer than a\n\"v1.5.2.1.69.gcafe\"\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n GIT-VERSION-GEN |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 06c360b..ac6a062 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -18,7 +18,7 @@ elif test -d .git &&\n \tv[0-9]*) : happy ;;\n \tesac\n then\n-\tVN=$(echo \"$VN\" | sed -e 's/-/./g');\n+\t:;\n else\n \tVN=\"$DEF_VER\"\n fi\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46073","messageId":"1183193782172-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937823982-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] git-remote: document -n","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:16Z","receivedAt":"2007-06-30T08:56:16Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nThe 'show' and 'prune' commands accept an option '-n'; document what\nit does.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/git-remote.txt |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt\nindex ab232c2..61a6022 100644\n--- a/Documentation/git-remote.txt\n+++ b/Documentation/git-remote.txt\n@@ -49,6 +49,9 @@ branch the `HEAD` at the remote repository actually points at.\n 'show'::\n \n Gives some information about the remote <name>.\n++\n+With `-n` option, the remote heads are not queried first with\n+`git ls-remote <name>`; cached information is used instead.\n \n 'prune'::\n \n@@ -56,6 +59,10 @@ Deletes all stale tracking branches under <name>.\n These stale branches have already been removed from the remote repository\n referenced by <name>, but are still locally available in\n \"remotes/<name>\".\n++\n+With `-n` option, the remote heads are not confirmed first with `git\n+ls-remote <name>`; cached information is used instead.  Use with\n+caution.\n \n 'update'::\n \n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46072","messageId":"11831937822249-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"1183193782172-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] git-remote: allow 'git-remote fetch' as a synonym for 'git fetch'","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:17Z","receivedAt":"2007-06-30T08:56:17Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nI found myself typing this when doing remote-like things.  Perhaps\nother people will find this useful\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/git-remote.txt |    4 ++++\n git-remote.perl              |    4 ++++\n 2 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt\nindex 61a6022..b462ccd 100644\n--- a/Documentation/git-remote.txt\n+++ b/Documentation/git-remote.txt\n@@ -64,6 +64,10 @@ With `-n` option, the remote heads are not confirmed first with `git\n ls-remote <name>`; cached information is used instead.  Use with\n caution.\n \n+'fetch'::\n+\n+Synonym for `git fetch <name>`, and accepts all the same options.\n+\n 'update'::\n \n Fetch updates for a named set of remotes in the repository as defined by\ndiff --git a/git-remote.perl b/git-remote.perl\nindex b59cafd..2c60cae 100755\n--- a/git-remote.perl\n+++ b/git-remote.perl\n@@ -404,11 +404,15 @@ elsif ($ARGV[0] eq 'add') {\n \t}\n \tadd_remote($ARGV[1], $ARGV[2], \\%opts);\n }\n+elsif ($ARGV[0] eq 'fetch') {\n+\texec(\"git-fetch\", @ARGV[1..$#ARGV]);\n+}\n else {\n \tprint STDERR \"Usage: git remote\\n\";\n \tprint STDERR \"       git remote add <name> <url>\\n\";\n \tprint STDERR \"       git remote show <name>\\n\";\n \tprint STDERR \"       git remote prune <name>\\n\";\n \tprint STDERR \"       git remote update [group]\\n\";\n+\tprint STDERR \"       git remote fetch <fetch-options> <repository> <refspec>...\\n\";\n \texit(1);\n }\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46078","messageId":"11831937823756-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937822249-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] git-merge-ff: fast-forward only merge","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:18Z","receivedAt":"2007-06-30T08:56:18Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"This is primarily so that there is an easy switch to 'git-pull' to\nbe sure to fast forward only.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/merge-strategies.txt |    5 +++++\n Makefile                           |    2 +-\n git-merge-ff.sh                    |    8 ++++++++\n git-merge.sh                       |    4 ++--\n 4 files changed, 16 insertions(+), 3 deletions(-)\n create mode 100644 git-merge-ff.sh\n\ndiff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt\nindex 7df0266..00739bc 100644\n--- a/Documentation/merge-strategies.txt\n+++ b/Documentation/merge-strategies.txt\n@@ -33,3 +33,8 @@ ours::\n \tmerge is always the current branch head.  It is meant to\n \tbe used to supersede old development history of side\n \tbranches.\n+\n+ff::\n+\tThis is a degenerate merge strategy that always fails, which\n+\tmeans that the only time the target branch will change is if\n+\tthere was no merge (\"fast-forward\" merge only).\ndiff --git a/Makefile b/Makefile\nindex 4ea5e45..7fa8fe3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -210,7 +210,7 @@ SCRIPT_SH = \\\n \tgit-tag.sh git-verify-tag.sh \\\n \tgit-am.sh \\\n \tgit-merge.sh git-merge-stupid.sh git-merge-octopus.sh \\\n-\tgit-merge-resolve.sh git-merge-ours.sh \\\n+\tgit-merge-resolve.sh git-merge-ours.sh git-merge-ff.sh \\\n \tgit-lost-found.sh git-quiltimport.sh git-submodule.sh \\\n \tgit-filter-branch.sh\n \ndiff --git a/git-merge-ff.sh b/git-merge-ff.sh\nnew file mode 100644\nindex 0000000..b0e0f85\n--- /dev/null\n+++ b/git-merge-ff.sh\n@@ -0,0 +1,8 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Sam Vilain\n+#\n+# A degenerate merge strategy that only allows fast-forwarding.\n+#\n+\n+exit 1;\ndiff --git a/git-merge.sh b/git-merge.sh\nindex 981d69d..63aa374 100755\n--- a/git-merge.sh\n+++ b/git-merge.sh\n@@ -16,10 +16,10 @@ test -z \"$(git ls-files -u)\" ||\n LF='\n '\n \n-all_strategies='recur recursive octopus resolve stupid ours subtree'\n+all_strategies='recur recursive octopus resolve stupid ours subtree ff'\n default_twohead_strategies='recursive'\n default_octopus_strategies='octopus'\n-no_trivial_merge_strategies='ours subtree'\n+no_trivial_merge_strategies='ours subtree ff'\n use_strategies=\n \n index_merge=t\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46079","messageId":"11831937822950-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937823756-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] git-mergetool: add support for ediff","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:19Z","receivedAt":"2007-06-30T08:56:19Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"There was emerge already but I much prefer this mode.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/config.txt        |    3 ++-\n Documentation/git-mergetool.txt |    3 ++-\n git-mergetool.sh                |   19 ++++++++++++++-----\n 3 files changed, 18 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 50503e8..4661e24 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -550,7 +550,8 @@ merge.summary::\n merge.tool::\n \tControls which merge resolution program is used by\n \tgitlink:git-mergetool[l].  Valid values are: \"kdiff3\", \"tkdiff\",\n-\t\"meld\", \"xxdiff\", \"emerge\", \"vimdiff\", \"gvimdiff\", and \"opendiff\".\n+\t\"meld\", \"xxdiff\", \"emerge\", \"ediff\", \"vimdiff\", \"gvimdiff\", and\n+\t\"opendiff\".\n \n merge.verbosity::\n \tControls the amount of output shown by the recursive merge\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex 6c32c6d..1efe6e4 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -25,7 +25,8 @@ OPTIONS\n -t or --tool=<tool>::\n \tUse the merge resolution program specified by <tool>.\n \tValid merge tools are:\n-\tkdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, and opendiff\n+\tkdiff3, tkdiff, meld, xxdiff, emerge, ediff, vimdiff, gvimdiff,\n+\tand opendiff\n +\n If a merge resolution program is not specified, 'git mergetool'\n will use the configuration variable merge.tool.  If the\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex 7b66309..6fda8af 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -258,6 +258,15 @@ merge_file () {\n \t    status=$?\n \t    save_backup\n \t    ;;\n+\tediff)\n+\t    if base_present ; then\n+\t\temacs --eval \"(ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$path\\\")\"\n+\t    else\n+\t\temacs --eval \"(ediff-merge-files \\\"$LOCAL\\\" \\\"$REMOTE\\\" nil \\\"$path\\\")\"\n+\t    fi\n+\t    status=$?\n+\t    save_backup\n+\t    ;;\n     esac\n     if test \"$status\" -ne 0; then\n \techo \"merge of $path failed\" 1>&2\n@@ -299,7 +308,7 @@ done\n if test -z \"$merge_tool\"; then\n     merge_tool=`git-config merge.tool`\n     case \"$merge_tool\" in\n-\tkdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | \"\")\n+\tkdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | ediff | vimdiff | gvimdiff | \"\")\n \t    ;; # happy\n \t*)\n \t    echo >&2 \"git config option merge.tool set to unknown tool: $merge_tool\"\n@@ -320,15 +329,15 @@ if test -z \"$merge_tool\" ; then\n         fi\n     fi\n     if echo \"${VISUAL:-$EDITOR}\" | grep 'emacs' > /dev/null 2>&1; then\n-        merge_tool_candidates=\"$merge_tool_candidates emerge\"\n+        merge_tool_candidates=\"$merge_tool_candidates emerge ediff\"\n     fi\n     if echo \"${VISUAL:-$EDITOR}\" | grep 'vim' > /dev/null 2>&1; then\n         merge_tool_candidates=\"$merge_tool_candidates vimdiff\"\n     fi\n-    merge_tool_candidates=\"$merge_tool_candidates opendiff emerge vimdiff\"\n+    merge_tool_candidates=\"$merge_tool_candidates opendiff ediff emerge vimdiff\"\n     echo \"merge tool candidates: $merge_tool_candidates\"\n     for i in $merge_tool_candidates; do\n-        if test $i = emerge ; then\n+        if test $i = emerge || test $i = ediff ; then\n             cmd=emacs\n         else\n             cmd=$i\n@@ -351,7 +360,7 @@ case \"$merge_tool\" in\n \t    exit 1\n \tfi\n \t;;\n-    emerge)\n+    emerge|ediff)\n \tif ! type \"emacs\" > /dev/null 2>&1; then\n \t    echo \"Emacs is not available\"\n \t    exit 1\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46081","messageId":"11831937823588-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937822950-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] contrib/hooks: add post-update hook for updating working copy","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:20Z","receivedAt":"2007-06-30T08:56:20Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Many users want 'git push' to work like 'git pull'; that is, after the\ntransfer of the new objects, the working copy is updated, too.  This\nhook tries to be paranoid and never lose any information, as well as\nbeing able to be safely just chmod +x'ed without destroying anything\nit shouldn't.\n\nAlso allude to this potential feature on the man page for git-push.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/git-push.txt   |    4 ++-\n templates/hooks--post-update |   78 +++++++++++++++++++++++++++++++++++++++--\n 2 files changed, 77 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\nindex 665f6dc..9f5fbc7 100644\n--- a/Documentation/git-push.txt\n+++ b/Documentation/git-push.txt\n@@ -20,7 +20,9 @@ necessary to complete the given refs.\n \n You can make interesting things happen to a repository\n every time you push into it, by setting up 'hooks' there.  See\n-documentation for gitlink:git-receive-pack[1].\n+documentation for gitlink:git-receive-pack[1].  One commonly\n+requested feature, updating the working copy of the target\n+repository, must be enabled in this way.\n \n \n OPTIONS\ndiff --git a/templates/hooks--post-update b/templates/hooks--post-update\nindex bcba893..b5d490c 100644\n--- a/templates/hooks--post-update\n+++ b/templates/hooks--post-update\n@@ -1,8 +1,78 @@\n #!/bin/sh\n #\n-# An example hook script to prepare a packed repository for use over\n-# dumb transports.\n+# This hook does two things:\n #\n-# To enable this hook, make this file executable by \"chmod +x post-update\".\n+#  1. update the \"info\" files that allow the list of references to be\n+#     queries over dumb transports such as http\n+#\n+#  2. if this repository looks like it is a non-bare repository, and\n+#     the checked-out branch is pushed to, then update the working copy.\n+#     This makes \"push\" and \"pull\" symmetric operations, as in darcs and\n+#     bzr.\n+\n+git-update-server-info\n+\n+export GIT_DIR=`cd $GIT_DIR; pwd`\n+[ `expr \"$GIT_DIR\" : '.*/\\.git'` = 0 ] && exit 0\n+\n+tree_in_revlog() {\n+    ref=$1\n+    tree=$2\n+    found=$(\n+    tail logs/$ref | while read commit rubbish\n+    do\n+        this_tree=`git-rev-parse commit $commit^{tree}`\n+\tif [ \"$this_tree\" = \"$tree\" ]\n+        then\n+\t    echo $commit\n+        fi\n+    done\n+    )\n+    [ -n \"$found\" ] && true\n+}\n+\n+for ref\n+do\n+active=`git-symbolic-ref HEAD`\n+if [ \"$ref\" = \"$active\" ]\n+then\n+  echo \"Pushing to checked out branch - updating working copy\" >&2\n+  success=\n+  if ! (cd ..; git-diff-files) | grep -q .\n+  then\n+    # save the current index just in case\n+    current_tree=`git-write-tree`\n+    if tree_in_revlog $ref $current_tree\n+    then\n+      cd ..\n+      if git-diff-index -R --name-status HEAD >&2 &&\n+         git-diff-index -z --name-only --diff-filter=A HEAD | xargs -0r rm &&\n+         git-reset --hard HEAD\n+      then\n+         success=1\n+      else\n+        echo \"E:unexpected error during update\" >&2\n+      fi\n+    else\n+      echo \"E:uncommitted, staged changes found\" >&2\n+    fi\n+  else\n+    echo \"E:unstaged changes found\" >&2\n+  fi\n \n-exec git-update-server-info\n+  if [ -z \"$success\" ]\n+  then\n+    (\n+    echo \"Non-bare repository checkout is not clean - not updating it\"\n+    echo \"However I AM going to update the index.  Any half-staged commit\"\n+    echo \"in that checkout will be thrown away, but on the bright side\"\n+    echo \"this is probably the least confusing thing for us to do and at\"\n+    echo \"least we're not throwing any files somebody has changed away\"\n+    git-reset --mixed HEAD\n+    echo\n+    echo \"This is the new status of the upstream working copy:\"\n+    git-status\n+    ) >&2\n+  fi\n+fi\n+done\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46077","messageId":"1183193782608-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8780","inReplyTo":"11831937823588-git-send-email-sam.vilain@catalyst.net.nz","subject":"[PATCH] git-repack: generational repacking (and example hook script)","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-30T08:56:21Z","receivedAt":"2007-06-30T08:56:21Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Add an option to git-repack that makes the repack run suitable for\nrunning very often.  The idea is that packs get given a \"generation\",\nand that the number of packs in each generation (except the last one)\nis bounded.\n\nThe useful invocation of this is git-repack -d -g\n\nThe -a option then becomes a degenerate case of generative repacking.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/git-repack.txt |    6 +++\n git-repack.sh                |   74 +++++++++++++++++++++++++++++++++++-------\n templates/hooks--post-commit |   14 +++++++-\n 3 files changed, 81 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt\nindex be8e5f8..d458377 100644\n--- a/Documentation/git-repack.txt\n+++ b/Documentation/git-repack.txt\n@@ -42,6 +42,12 @@ OPTIONS\n \texisting packs redundant, remove the redundant packs.\n \tAlso runs gitlink:git-prune-packed[1].\n \n+-g::\n+\tEnable \"generational\" repacking.  This attempts to keep the\n+\tnumber of packs under control when repacking very often.  Most\n+\tuseful when called from the `post-commit` hook (see\n+\tlink:hooks.html[hooks] for more information).\n+\n -l::\n         Pass the `--local` option to `git pack-objects`, see\n         gitlink:git-pack-objects[1].\ndiff --git a/git-repack.sh b/git-repack.sh\nindex 8c32724..3d253fa 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -3,19 +3,21 @@\n # Copyright (c) 2005 Linus Torvalds\n #\n \n-USAGE='[-a] [-d] [-f] [-l] [-n] [-q] [--max-pack-size=N] [--window=N] [--depth=N]'\n+USAGE='[-a] [-d] [-f] [-l] [-n] [-q] [-g] [--max-pack-size=N] [--window=N] [--depth=N]'\n SUBDIRECTORY_OK='Yes'\n . git-sh-setup\n \n-no_update_info= all_into_one= remove_redundant=\n-local= quiet= no_reuse= extra=\n+no_update_info= generations= remove_redundant=\n+local= quiet= no_reuse= extra= generation_width=\n while case \"$#\" in 0) break ;; esac\n do\n \tcase \"$1\" in\n \t-n)\tno_update_info=t ;;\n-\t-a)\tall_into_one=t ;;\n+\t-a)\tgenerations=0 ;;\n \t-d)\tremove_redundant=t ;;\n \t-q)\tquiet=-q ;;\n+\t-g)\tgenerations=3 generation_width=10 ;;\n+\t-G)\tgenerations=$2; generation_width=5; shift ;;\n \t-f)\tno_reuse=--no-reuse-object ;;\n \t-l)\tlocal=--local ;;\n \t--max-pack-size=*) extra=\"$extra $1\" ;;\n@@ -40,24 +42,69 @@ PACKTMP=\"$GIT_OBJECT_DIRECTORY/.tmp-$$-pack\"\n rm -f \"$PACKTMP\"-*\n trap 'rm -f \"$PACKTMP\"-*' 0 1 2 3 15\n \n+generation=\n+redundant=\n+\n # There will be more repacking strategies to come...\n-case \",$all_into_one,\" in\n+case \",$generations,\" in\n ,,)\n \targs='--unpacked --incremental'\n \t;;\n-,t,)\n+,*,)\n \tif [ -d \"$PACKDIR\" ]; then\n+\t\tmax_gen=0\n \t\tfor e in `cd \"$PACKDIR\" && find . -type f -name '*.pack' \\\n \t\t\t| sed -e 's/^\\.\\///' -e 's/\\.pack$//'`\n \t\tdo\n \t\t\tif [ -e \"$PACKDIR/$e.keep\" ]; then\n \t\t\t\t: keep\n \t\t\telse\n-\t\t\t\targs=\"$args --unpacked=$e.pack\"\n \t\t\t\texisting=\"$existing $e\"\n+\t\t\t\tif [ -e \"$PACKDIR/$e.gen\" ]; then\n+\t\t\t\t\tgen=`cat $PACKDIR/$e.gen`\n+\t\t\t\telse\n+\t\t\t\t\tgen=1\n+\t\t\t\tfi\n+\t\t\t\t[ \"$max_gen\" -lt $gen ] && max_gen=$gen\n+\t\t\t\teval \"gen_${gen}=\\\"\\$gen_${gen} $e\\\"\";\n+\t\t\t\teval \"c_gen_${gen}=\\$((\\$c_gen_${gen} + 1))\";\n \t\t\tfi\n \t\tdone\n+\t\ti=$max_gen\n+\t\tpacking=\n+\t\twhile [ $i -gt 0 ]\n+\t\tdo\n+\t\t\teval \"c_gen=\\$c_gen_$i\"\n+\t\t\teval \"packs=\\$gen_$i\"\n+\t\t\tif [ -n \"$c_gen\" -a $i -gt \"$generations\" ]\n+\t\t\tthen\n+\t\t\t\techo \"saw $c_gen packs at generation $i\"\n+\t\t\t\techo \"therefore, repacking everything\"\n+\t\t\t\tpacking=1\n+\t\t\t\t[ -z \"$generation\" ] && generation=$(($i + 1))\n+\t\t\telif [ -n \"$c_gen\" -a \"$c_gen\" -ge \"$generation_width\" -a \"$i\" -lt \"$generations\" ]\n+\t\t\tthen\n+\t\t\t\techo -n \"generation $i has too many packs \"\n+\t\t\t\techo \"($c_gen >= $generation_width)\"\n+\t\t\t\techo \"repacking at this level and below\"\n+\t\t\t\tpacking=1\n+\t\t\t\t[ -z \"$generation\" ] && generation=$(($i + 1))\n+\t\t\tfi\n+\t\t\tif [ -n \"$packing\" ]\n+\t\t\tthen\n+\t\t\t\tfor x in $packs; do\n+\t\t\t\t\targs=\"$args --unpacked=$x.pack\"\n+\t\t\t\t\tredundant=\"$redundant $x\"\n+\t\t\t\tdone\n+\t\t\tfi\n+\t\t\ti=$(($i - 1))\n+\t\tdone\n+\t\tif [ -n \"$generation\" ]; then\n+\t\t\t[ \"$generation\" -gt \"$generations\" ] && generation=$generations\n+\t\t\t[ \"$generation\" -eq 0 ] && generation=1\n+\t\tfi\n \tfi\n+\n \t[ -z \"$args\" ] && args='--unpacked --incremental'\n \t;;\n esac\n@@ -95,20 +142,23 @@ for name in $names ; do\n \t\texit 1\n \t}\n \trm -f \"$PACKDIR/old-pack-$name.pack\" \"$PACKDIR/old-pack-$name.idx\"\n+\t[ -n \"$generation\" ] && echo $generation > \"$PACKDIR/pack-$name.gen\"\n done\n \n if test \"$remove_redundant\" = t\n then\n-\t# We know $existing are all redundant.\n-\tif [ -n \"$existing\" ]\n+\techo \"removing redundant packs\"\n+\t# We know $redundant are all redundant.\n+\tif [ -n \"$redundant\" ]\n \tthen\n \t\tsync\n \t\t( cd \"$PACKDIR\" &&\n-\t\t  for e in $existing\n+\t\t  for e in $redundant\n \t\t  do\n \t\t\tcase \" $fullbases \" in\n-\t\t\t*\" $e \"*) ;;\n-\t\t\t*)\trm -f \"$e.pack\" \"$e.idx\" \"$e.keep\" ;;\n+\t\t\t*\" $e \"*) echo \"ignoring $e\" ;;\n+\t\t\t*)\techo \"removing $e.pack etc\";\n+\t\t\t\trm -f \"$e.pack\" \"$e.idx\" \"$e.keep\" ;;\n \t\t\tesac\n \t\t  done\n \t\t)\ndiff --git a/templates/hooks--post-commit b/templates/hooks--post-commit\nindex 8be6f34..669f1fc 100644\n--- a/templates/hooks--post-commit\n+++ b/templates/hooks--post-commit\n@@ -5,4 +5,16 @@\n #\n # To enable this hook, make this file executable.\n \n-: Nothing\n+threshold=`git-config gc.threshold`\n+threshold=${threshold-250}\n+\n+gd=`git-rev-parse --git-dir`\n+found=$(find $gd/objects/?? -type f | head -$threshold | wc -l)\n+\n+if [ $found -ge $threshold ]\n+then\n+    echo \"At least $threshold loose objects, running generational repack\"\n+    git-repack -g -d\n+else\n+    echo \"Found only $found loose objects, less than $threshold\"\n+fi\n-- \n1.5.2.1.1131.g3b90\n"},{"id":"46082","messageId":"20070630110550.GP12721@planck.djpig.de","threadId":"8780","inReplyTo":"1183193781941-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: a bunch of outstanding updates","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-06-30T11:05:50Z","receivedAt":"2007-06-30T11:05:50Z","isPatch":false,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Sat, Jun 30, 2007 at 08:56:11PM +1200, Sam Vilain wrote:\n> \n> Following up to this e-mail are a whole load of outstanding feature\n> requests of mine.\n\nFWIW, I would prefer you'd use --no-chain-reply-to for totally unrelated\nchanges. (But really I would prefer not to have -chain-reply-to as\ndefault anyway...)\n\njust my 2¢\n\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"46083","messageId":"20070630111240.GQ12721@planck.djpig.de","threadId":"8780","inReplyTo":"1183193782172-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-remote: document -n","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-06-30T11:12:40Z","receivedAt":"2007-06-30T11:12:40Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Sat, Jun 30, 2007 at 08:56:16PM +1200, Sam Vilain wrote:\n> From: Sam Vilain <sam@vilain.net>\n> \n> The 'show' and 'prune' commands accept an option '-n'; document what\n> it does.\n\nYou might want to add that in the SYNOPSIS, too.\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"46084","messageId":"20070630111551.GR12721@planck.djpig.de","threadId":"8780","inReplyTo":"11831937813223-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] repack: improve documentation on -a option","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-06-30T11:15:51Z","receivedAt":"2007-06-30T11:15:51Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Sat, Jun 30, 2007 at 08:56:12PM +1200, Sam Vilain wrote:\n>  -a::\n>  \tInstead of incrementally packing the unpacked objects,\n> -\tpack everything available into a single pack.\n> +\tpack everything referenced into a single pack.\n>  \tEspecially useful when packing a repository that is used\n> -\tfor private development and there is no need to worry\n> -\tabout people fetching via dumb file transfer protocols\n> -\tfrom it.  Use with '-d'.\n> +\tfor private development and there no need to worry\n\nGot \"is\" lost here intentionally? The change doesn't make sense\nto me.\n\n> +\tabout people fetching via dumb protocols from it.  Use\n> +\twith '-d'.  This will clean up the objects that `git prune`\n> +\tleaves behind, but `git fsck-objects --full` shows as\n> +\tdangling.\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"46089","messageId":"Pine.LNX.4.64.0706301523210.4438@racer.site","threadId":"8780","inReplyTo":"11831937823756-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-merge-ff: fast-forward only merge","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-30T14:28:17Z","receivedAt":"2007-06-30T14:28:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 30 Jun 2007, Sam Vilain wrote:\n\n>  Documentation/merge-strategies.txt |    5 +++++\n>  Makefile                           |    2 +-\n>  git-merge-ff.sh                    |    8 ++++++++\n>  git-merge.sh                       |    4 ++--\n\nStill no test script that could tell you if it does what it is supposed to \nbe...\n\nCiao,\nDscho\n"},{"id":"46097","messageId":"7vved5e4ws.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"11831937823982-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] GIT-VERSION-GEN: don't convert - delimiter to .'s","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-30T17:19:31Z","receivedAt":"2007-06-30T17:19:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> writes:\n\n> Otherwise, a custom \"v1.5.2.42.gb1ff\" is considered newer than a\n> \"v1.5.2.1.69.gcafe\"\n\nDoes this solve anything, I wonder?  v1.5.2-this and\nv1.5.2.1-that are not really comparable to begin with.\n"},{"id":"46098","messageId":"7vps3de4wr.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"11831937822249-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-remote: allow 'git-remote fetch' as a synonym for 'git fetch'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-30T17:19:32Z","receivedAt":"2007-06-30T17:19:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> writes:\n\n> From: Sam Vilain <sam@vilain.net>\n>\n> I found myself typing this when doing remote-like things.  Perhaps\n> other people will find this useful\n\nI would like to reject this, for the same reason I did not apply\nthree patch series \"Human friendly git\" on April 1st this year\n;-).\n"},{"id":"46099","messageId":"7vk5tle4wq.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"11831937822950-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-mergetool: add support for ediff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-30T17:19:33Z","receivedAt":"2007-06-30T17:19:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> writes:\n\n> There was emerge already but I much prefer this mode.\n\nI thought Ted said he'll look into clearning this up, so I won't\napply it yet at this moment to my tree, but have one comment...\n\n> @@ -320,15 +329,15 @@ if test -z \"$merge_tool\" ; then\n>          fi\n>      fi\n>      if echo \"${VISUAL:-$EDITOR}\" | grep 'emacs' > /dev/null 2>&1; then\n> -        merge_tool_candidates=\"$merge_tool_candidates emerge\"\n> +        merge_tool_candidates=\"$merge_tool_candidates emerge ediff\"\n>      fi\n>      if echo \"${VISUAL:-$EDITOR}\" | grep 'vim' > /dev/null 2>&1; then\n>          merge_tool_candidates=\"$merge_tool_candidates vimdiff\"\n>      fi\n> -    merge_tool_candidates=\"$merge_tool_candidates opendiff emerge vimdiff\"\n> +    merge_tool_candidates=\"$merge_tool_candidates opendiff ediff emerge vimdiff\"\n>      echo \"merge tool candidates: $merge_tool_candidates\"\n\nSo by default outside X environment, if your $EDITOR is emacs,\nyou would use emerge and not ediff, but if your $EDITOR is unset\nand have emacs in your $PATH you would use ediff not emerge?\n"},{"id":"46102","messageId":"7vejjte4wp.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"11831937823588-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] contrib/hooks: add post-update hook for updating working copy","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-30T17:19:34Z","receivedAt":"2007-06-30T17:19:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> writes:\n\n> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt\n> index 665f6dc..9f5fbc7 100644\n> --- a/Documentation/git-push.txt\n> +++ b/Documentation/git-push.txt\n> @@ -20,7 +20,9 @@ necessary to complete the given refs.\n>  \n>  You can make interesting things happen to a repository\n>  every time you push into it, by setting up 'hooks' there.  See\n> -documentation for gitlink:git-receive-pack[1].\n> +documentation for gitlink:git-receive-pack[1].  One commonly\n> +requested feature, updating the working copy of the target\n> +repository, must be enabled in this way.\n\nThat is more like \"could be\", not \"must be\", and it is not the\nmanpage's job to pass judgement on if a feature is often requested.\n\n> diff --git a/templates/hooks--post-update b/templates/hooks--post-update\n> index bcba893..b5d490c 100644\n> --- a/templates/hooks--post-update\n> +++ b/templates/hooks--post-update\n> @@ -1,8 +1,78 @@\n>  #!/bin/sh\n>  #\n> -# An example hook script to prepare a packed repository for use over\n> -# dumb transports.\n> +# This hook does two things:\n>  #\n> -# To enable this hook, make this file executable by \"chmod +x post-update\".\n> +#  1. update the \"info\" files that allow the list of references to be\n> +#     queries over dumb transports such as http\n> +#\n> +#  2. if this repository looks like it is a non-bare repository, and\n> +#     the checked-out branch is pushed to, then update the working copy.\n> +#     This makes \"push\" and \"pull\" symmetric operations, as in darcs and\n> +#     bzr.\n> +\n> +git-update-server-info\n> +\n> +export GIT_DIR=`cd $GIT_DIR; pwd`\n> +[ `expr \"$GIT_DIR\" : '.*/\\.git'` = 0 ] && exit 0\n\nThat's convoluted.  If you use 'expr', probably\n\n\texpr \"$GIT_DIR\" : '.*/\\.git' >/dev/null || exit 0\n\nbut I would probably do without an extra fork, like this:\n\n\tcase \"$GIT_DIR\" in */.git) : happy ;; *) exit 0 ;; esac\n\nAlso you can exit early if $GIT_DIR/index does not exist.\n\n> +\n> +tree_in_revlog() {\n\nrevlog?  Since when are we Hg?\n\n> +    ref=$1\n> +    tree=$2\n> +    found=$(\n> +    tail logs/$ref | while read commit rubbish\n> +    do\n> +        this_tree=`git-rev-parse commit $commit^{tree}`\n> +\tif [ \"$this_tree\" = \"$tree\" ]\n> +        then\n> +\t    echo $commit\n> +        fi\n> +    done\n> +    )\n> +    [ -n \"$found\" ] && true\n> +}\n\nI would imagine that \"$some_command && true\" would always give\nthe same result as \"$some_command\" alone.  I'd just write this\nas:\n\n\ttest -n \"$found\"\n\nif I were you.\n\n> +\n> +for ref\n> +do\n> +active=`git-symbolic-ref HEAD`\n\n - You do not want to do this inside \"for ref\" loop as this is\n   constant expression.\n\n - When the HEAD is detached, this will give you an error message,\n   and an empty string.  But you do not care about detached HEAD\n   case anyway I would imagine.\n\nPerhaps...\n\n\tactive=$(git symbolic-ref -q HEAD) || exit 0\n\tfor ref\n        do\n        \t...\n\n> +if [ \"$ref\" = \"$active\" ]\n> +then\n> +  echo \"Pushing to checked out branch - updating working copy\" >&2\n> +  success=\n> +  if ! (cd ..; git-diff-files) | grep -q .\n> +  then\n\nTrying to see if there is any difference from the index, aka\n\n\tgit diff-files --quiet\n\n?\n\n> +    # save the current index just in case\n> +    current_tree=`git-write-tree`\n\nWhat happens if the user is in the middle of a merge?\nwrite-tree would fail and you should error out.\n\n> +    if tree_in_revlog $ref $current_tree\n> +    then\n\nWhy should it behave differently depending on whether the index\nmatches one of the arbitrary (i.e. taken from \"tail\" default)\nnumber of commits the user happened to be at in the recent past?\nIf the check were \"does it match with the HEAD\", there could be\na valid justification but this check does not make any sense to\nme.\n\n> +      cd ..\n> +      if git-diff-index -R --name-status HEAD >&2 &&\n> +         git-diff-index -z --name-only --diff-filter=A HEAD | xargs -0r rm &&\n> +         git-reset --hard HEAD\n\nI do not understand the first two lines at all.  Are you trying\nto lose working files for the paths that were added to the index\nsince HEAD?  \"git reset --hard HEAD\" should take care of that\nalready.  To test:\n\n\t$ >a-new-file\n        $ git add a-new-file\n        $ git reset --hard HEAD\n        $ ls -l a-new-file\n\tls: a-new-file: No such file or directory\n\nBut more importantly, why is it justified to throw away such\nfiles to begin with?\n\n> +      then\n> +         success=1\n> +      else\n> +        echo \"E:unexpected error during update\" >&2\n> +      fi\n> +    else\n> +      echo \"E:uncommitted, staged changes found\" >&2\n> +    fi\n> +  else\n> +    echo \"E:unstaged changes found\" >&2\n> +  fi\n\nI think this part is a good demonstration why pushing into a\nlive branch should not attempt to update the working tree.  It\nsometimes happens, and it sometimes cannot (which is not your\nfault at all), but the indication of what happened (or did not\nhappen) goes to the person who pushed the changes, not to the\nperson who gets confusing behaviour if the index/worktree\nsuddenly goes out of sync with respect to the updated HEAD.\n\nThe longer I look at this patch, the more inclined I become to\nsay that the only part that is worth saving is the next hunk.\n\n> -exec git-update-server-info\n> +  if [ -z \"$success\" ]\n> +  then\n> +    (\n> +    echo \"Non-bare repository checkout is not clean - not updating it\"\n> +    echo \"However I AM going to update the index.  Any half-staged commit\"\n> +    echo \"in that checkout will be thrown away, but on the bright side\"\n> +    echo \"this is probably the least confusing thing for us to do and at\"\n> +    echo \"least we're not throwing any files somebody has changed away\"\n> +    git-reset --mixed HEAD\n> +    echo\n> +    echo \"This is the new status of the upstream working copy:\"\n> +    git-status\n> +    ) >&2\n> +  fi\n> +fi\n> +done\n> -- \n> 1.5.2.1.1131.g3b90\n"},{"id":"46100","messageId":"7v3b09e4wn.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"20070630111551.GR12721@planck.djpig.de","subject":"Re: [PATCH] repack: improve documentation on -a option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-30T17:19:36Z","receivedAt":"2007-06-30T17:19:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Frank Lichtenheld <frank@lichtenheld.de> writes:\n\n> On Sat, Jun 30, 2007 at 08:56:12PM +1200, Sam Vilain wrote:\n>>  -a::\n>>  \tInstead of incrementally packing the unpacked objects,\n>> -\tpack everything available into a single pack.\n>> +\tpack everything referenced into a single pack.\n>>  \tEspecially useful when packing a repository that is used\n>> -\tfor private development and there is no need to worry\n>> -\tabout people fetching via dumb file transfer protocols\n>> -\tfrom it.  Use with '-d'.\n>> +\tfor private development and there no need to worry\n>\n> Got \"is\" lost here intentionally? The change doesn't make sense\n> to me.\n>\n>> +\tabout people fetching via dumb protocols from it.  Use\n>> +\twith '-d'.  This will clean up the objects that `git prune`\n>> +\tleaves behind, but `git fsck-objects --full` shows as\n>> +\tdangling.\n\nAlso 'fsck-objects' is somewhat outdated.  Will fix them up.\n"},{"id":"46112","messageId":"20070630183231.GA15774@moooo.ath.cx","threadId":"8780","inReplyTo":"11831937823756-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-merge-ff: fast-forward only merge","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-06-30T18:32:31Z","receivedAt":"2007-06-30T18:32:31Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> wrote:\n> This is primarily so that there is an easy switch to 'git-pull' to\n> be sure to fast forward only.\n\nIs this still broken or am I just doing something totally wrong?\n\n    % git reset --hard origin/master~15\n    HEAD is now at e1341ab... Merge branch 'master' of git://git.kernel.org/pub/scm/gitk/gitk into pm/gitk\n    % git merge -s ff origin/master\n    Automatic merge failed; fix conflicts and then commit the result.\n    [1]    19368 exit 1     git merge -s ff origin/master\n    % git merge origin/master   \n    Updating e1341ab..7c85173              \n    Fast forward\n    [..]\n     23 files changed, 236 insertions(+), 79 deletions(-)\n"},{"id":"46145","messageId":"7vfy48940k.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"11831937823184-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-svn: cache max revision in rev_db databases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-01T03:50:03Z","receivedAt":"2007-07-01T03:50:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> writes:\n\n> Cache the maximum revision for each rev_db URL rather than looking it\n> up each time.  This saves a lot of time when rebuilding indexes on a\n> freshly cloned repository.\n>\n> Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n\nI think both the previous one from Sam that makes it use git-log\ninstead of git-rev-list and this one looks sane.  Ack/Nack is\nappreciated.\n\n> ---\n>  git-svn.perl |    4 ++++\n>  1 files changed, 4 insertions(+), 0 deletions(-)\n>\n> diff --git a/git-svn.perl b/git-svn.perl\n> index 556cd7d..a8b6669 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -801,6 +801,7 @@ sub working_head_info {\n>  \tmy ($head, $refs) = @_;\n>  \tmy ($fh, $ctx) = command_output_pipe('log', $head);\n>  \tmy $hash;\n> +\tmy %max;\n>  \twhile (<$fh>) {\n>  \t\tif ( m{^commit ($::sha1)$} ) {\n>  \t\t\tunshift @$refs, $hash if $hash and $refs;\n> @@ -810,11 +811,14 @@ sub working_head_info {\n>  \t\tnext unless s{^\\s*(git-svn-id:)}{$1};\n>  \t\tmy ($url, $rev, $uuid) = extract_metadata($_);\n>  \t\tif (defined $url && defined $rev) {\n> +\t\t\tnext if $max{$url} and $max{$url} < $rev;\n>  \t\t\tif (my $gs = Git::SVN->find_by_url($url)) {\n>  \t\t\t\tmy $c = $gs->rev_db_get($rev);\n>  \t\t\t\tif ($c && $c eq $hash) {\n>  \t\t\t\t\tclose $fh; # break the pipe\n>  \t\t\t\t\treturn ($url, $rev, $uuid, $gs);\n> +\t\t\t\t} else {\n> +\t\t\t\t\t$max{$url} ||= $gs->rev_db_max;\n>  \t\t\t\t}\n>  \t\t\t}\n>  \t\t}\n> -- \n> 1.5.2.1.1131.g3b90\n"},{"id":"46147","messageId":"20070701053114.GA1787@muzzle","threadId":"8780","inReplyTo":"7vfy48940k.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-svn: cache max revision in rev_db databases","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-07-01T05:31:56Z","receivedAt":"2007-07-01T05:31:56Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Sam Vilain <sam.vilain@catalyst.net.nz> writes:\n> \n> > Cache the maximum revision for each rev_db URL rather than looking it\n> > up each time.  This saves a lot of time when rebuilding indexes on a\n> > freshly cloned repository.\n> >\n> > Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n> \n> I think both the previous one from Sam that makes it use git-log\n> instead of git-rev-list and this one looks sane.  Ack/Nack is\n> appreciated.\n\nNow that 80583c0ef61cc966c7eee79cf3623a83197e19b8 is in, both patches\nare:\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n> > ---\n> >  git-svn.perl |    4 ++++\n> >  1 files changed, 4 insertions(+), 0 deletions(-)\n> >\n> > diff --git a/git-svn.perl b/git-svn.perl\n> > index 556cd7d..a8b6669 100755\n> > --- a/git-svn.perl\n> > +++ b/git-svn.perl\n> > @@ -801,6 +801,7 @@ sub working_head_info {\n> >  \tmy ($head, $refs) = @_;\n> >  \tmy ($fh, $ctx) = command_output_pipe('log', $head);\n> >  \tmy $hash;\n> > +\tmy %max;\n> >  \twhile (<$fh>) {\n> >  \t\tif ( m{^commit ($::sha1)$} ) {\n> >  \t\t\tunshift @$refs, $hash if $hash and $refs;\n> > @@ -810,11 +811,14 @@ sub working_head_info {\n> >  \t\tnext unless s{^\\s*(git-svn-id:)}{$1};\n> >  \t\tmy ($url, $rev, $uuid) = extract_metadata($_);\n> >  \t\tif (defined $url && defined $rev) {\n> > +\t\t\tnext if $max{$url} and $max{$url} < $rev;\n> >  \t\t\tif (my $gs = Git::SVN->find_by_url($url)) {\n> >  \t\t\t\tmy $c = $gs->rev_db_get($rev);\n> >  \t\t\t\tif ($c && $c eq $hash) {\n> >  \t\t\t\t\tclose $fh; # break the pipe\n> >  \t\t\t\t\treturn ($url, $rev, $uuid, $gs);\n> > +\t\t\t\t} else {\n> > +\t\t\t\t\t$max{$url} ||= $gs->rev_db_max;\n> >  \t\t\t\t}\n> >  \t\t\t}\n> >  \t\t}\n> > -- \n> > 1.5.2.1.1131.g3b90\n> \n\n-- \nEric Wong\n"},{"id":"46153","messageId":"7vwsxk7h4j.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"20070701053114.GA1787@muzzle","subject":"Re: [PATCH] git-svn: cache max revision in rev_db databases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-01T06:49:48Z","receivedAt":"2007-07-01T06:49:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"},{"id":"46198","messageId":"46882AF2.6020705@vilain.net","threadId":"8780","inReplyTo":"7vejjte4wp.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] contrib/hooks: add post-update hook for updating working copy","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-07-01T22:30:10Z","receivedAt":"2007-07-01T22:30:10Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> >  You can make interesting things happen to a repository\n> > >  every time you push into it, by setting up 'hooks' there.  See\n> > > -documentation for gitlink:git-receive-pack[1].\n> > > +documentation for gitlink:git-receive-pack[1].  One commonly\n> > > +requested feature, updating the working copy of the target\n> > > +repository, must be enabled in this way.\n>\n> That is more like \"could be\", not \"must be\", and it is not the\n> manpage's job to pass judgement on if a feature is often requested.\n\nOk, I'll just remove that clause.  Or do you think it perhaps belongs in\na NOTES or HINTS section?\n\n>> +    if tree_in_revlog $ref $current_tree\n>> +    then\n> \n> Why should it behave differently depending on whether the index\n> matches one of the arbitrary (i.e. taken from \"tail\" default)\n> number of commits the user happened to be at in the recent past?\n> If the check were \"does it match with the HEAD\", there could be\n> a valid justification but this check does not make any sense to\n> me.\n\nOk, well first we check that the index matches the working copy.  But if\nthere are staged changes which have not been committed, then the written\ntree will (probably) not exist anywhere in the reflog for the current\nbranch, and we can stop.\n\nBasically I'm trying to figure out \"does the current index have any\nuncommitted changes\".  If it matches the tree from the previous (handful\nof) ref(s), then the answer is \"no\".  If we can't find it anywhere then\nit's probably got staged changes, and short of trying to move the\nchanges forward, we should stop.\n\n>> +      if git-diff-index -R --name-status HEAD >&2 &&\n>> +         git-diff-index -z --name-only --diff-filter=A HEAD | xargs -0r rm &&\n>> +         git-reset --hard HEAD\n> \n> I do not understand the first two lines at all.  Are you trying\n> to lose working files for the paths that were added to the index\n> since HEAD?  \"git reset --hard HEAD\" should take care of that\n> already.\n\nThe first one simply displays what is happening to the working copy for\nthe benefit of the user.\n\nThe second is implementing something I for some reason thought git-reset\nwasn't doing.\n\n> But more importantly, why is it justified to throw away such\n> files to begin with?\n\nBecause we've already previously decided that they are safely stowed in\na previous (via time/reflog) revision of the current branch.\n\n>> +        echo \"E:unexpected error during update\" >&2\n>> +      fi\n>> +    else\n>> +      echo \"E:uncommitted, staged changes found\" >&2\n>> +    fi\n>> +  else\n>> +    echo \"E:unstaged changes found\" >&2\n>> +  fi\n> \n> I think this part is a good demonstration why pushing into a\n> live branch should not attempt to update the working tree.  It\n> sometimes happens, and it sometimes cannot (which is not your\n> fault at all), but the indication of what happened (or did not\n> happen) goes to the person who pushed the changes, not to the\n> person who gets confusing behaviour if the index/worktree\n> suddenly goes out of sync with respect to the updated HEAD.\n\nOne counter-argument to this is that you indicate that is the behaviour\nthat you want when you chmod +x the hook.  It should gracefully step out\nof the way when people who currently set that hook active keep doing it.\n\nBut this problem exists without this hook, in fact it is far worse.  The\nindication of what happened goes nowhere, and the person gets extremely\nconfusing behaviour when they commit.\n\nPerhaps it would make sense to do this check in the \"update\" hook as\nwell, thereby chmod +x refuses to allow a push that touches the\ncurrently checked out branch.  The check would then be run twice if both\nhooks are enabled, unless the first one can signal success/verification\nto the second somehow.\n\n> The longer I look at this patch, the more inclined I become to\n> say that the only part that is worth saving is the next hunk.\n> \n>> -exec git-update-server-info\n>> +  if [ -z \"$success\" ]\n>> +  then\n>> +    (\n>> +    echo \"Non-bare repository checkout is not clean - not updating it\"\n>> +    echo \"However I AM going to update the index.  Any half-staged commit\"\n>> +    echo \"in that checkout will be thrown away, but on the bright side\"\n>> +    echo \"this is probably the least confusing thing for us to do and at\"\n>> +    echo \"least we're not throwing any files somebody has changed away\"\n>> +    git-reset --mixed HEAD\n>> +    echo\n>> +    echo \"This is the new status of the upstream working copy:\"\n>> +    git-status\n>> +    ) >&2\n>> +  fi\n>> +fi\n>> +done\n\nI disagree; I think any half-measure is going to leave new users\nhorribly surprised by what happens, and if you just reset the index then\nthe staged commit is lost.\n\nSam.\n"},{"id":"46199","messageId":"46882BB5.8050208@vilain.net","threadId":"8780","inReplyTo":"7vk5tle4wq.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-mergetool: add support for ediff","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-07-01T22:33:25Z","receivedAt":"2007-07-01T22:33:25Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> I thought Ted said he'll look into clearning this up, so I won't\n> apply it yet at this moment to my tree, but have one comment...\n\nYes, sorry I should have left this one out, it didn't get any changes.\n\nSam.\n"},{"id":"46205","messageId":"7vk5tj1uh4.fsf@assigned-by-dhcp.cox.net","threadId":"8780","inReplyTo":"46882AF2.6020705@vilain.net","subject":"Re: [PATCH] contrib/hooks: add post-update hook for updating working copy","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-02T01:10:15Z","receivedAt":"2007-07-02T01:10:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam@vilain.net> writes:\n\n> Basically I'm trying to figure out \"does the current index have any\n> uncommitted changes\".  If it matches the tree from the previous (handful\n> of) ref(s), then the answer is \"no\".  If we can't find it anywhere then\n> it's probably got staged changes, and short of trying to move the\n> changes forward, we should stop.\n\nThe fact that the index does not match the HEAD means that the\nuser (possibly not the one who is pushing) is in the middle of\ndoing something.  A tree that happens to match that state exists\nin the recent reflog history would only mean that the same state\nexists _somewhere_; it does not mean it is easy for the end user\nto go back to it at all.\n\n>> But more importantly, why is it justified to throw away such\n>> files to begin with?\n>\n> Because we've already previously decided that they are safely stowed in\n> a previous (via time/reflog) revision of the current branch.\n\nThe user may have spent hours to come up to that state while\ndoing something we do not have any way of knowing what, and this\n\"heuristic\" is allowing to lose that.  As you say, we do not\nlose the tree from the repository, but we lose track of which\nstate the user was interested in.  I find that unjustified.\n\n> Perhaps it would make sense to do this check in the \"update\" hook as\n> well, thereby chmod +x refuses to allow a push that touches the\n> currently checked out branch.\n\nHaving the check in update to prevent it makes sense,\nindependently.\n\n>> The longer I look at this patch, the more inclined I become to\n>> say that the only part that is worth saving is the next hunk.\n\nActually, I think \"the first sentence of the output in the next\nhunk\" was what I meant.  That is, \"we are not updating it\nbecause it is dirty and you cannot get back to the original\nstate if this was a mistake\".  And not updating the index nor\nthe working tree.\n\nHow about doing something simpler, more predicatable and safer,\nlike this...\n\n * If HEAD/index/working tree match, then obviously we can do an\n   equivalent of \"reset --hard\".  There is little chance that\n   this is a wrong thing to do, and even when the user did not\n   want that happen, the user can easily recover with for\n   example \"git checkout @{1} .\".  So I am not opposed to\n   updating the index/working tree in this case at all.\n\n * Otherwise, especially when HEAD and index do not match,\n   touching index nor working tree is absolutely a no-no,\n   without giving the user to sort the mess out.  So either in\n   \"update\" hook you prevent it from happening.\n\nLater, when we have git-stash, we can do a bit better in a dirty\nworking tree.  We could make a stash of the state _before_\nupdating the tip of the current branch, and let the push update\nthe tip, and do an equivalent of \"reset --hard\".  Unstashing the\nstate on top of the updated tip could fail, but at that point,\nthe user has the choice of making a new branch (or use detached\nHEAD) at @{1} (that is, the HEAD before the push updated it) and\nthen unstash the state on top of it to recreate the state before\nthe push made a mess.\n\n\n    \n"},{"id":"46318","messageId":"alpine.LFD.0.999.0707022331080.26459@xanadu.home","threadId":"8780","inReplyTo":"1183193782608-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-07-03T03:36:47Z","receivedAt":"2007-07-03T03:36:47Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Sat, 30 Jun 2007, Sam Vilain wrote:\n\n> Add an option to git-repack that makes the repack run suitable for\n> running very often.  The idea is that packs get given a \"generation\",\n> and that the number of packs in each generation (except the last one)\n> is bounded.\n\nPlease explain again why this should be useful and is worth the \ncomplexity it brings along.  Last time this was discussed I wasn't \nconvinced at all, and I'm still not convinced this time either.\n\n\nNicolas\n"},{"id":"46327","messageId":"4689D77D.20601@vilain.net","threadId":"8780","inReplyTo":"alpine.LFD.0.999.0707022331080.26459@xanadu.home","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-07-03T04:58:37Z","receivedAt":"2007-07-03T04:58:37Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Nicolas Pitre wrote:\n>> Add an option to git-repack that makes the repack run suitable for\n>> running very often.  The idea is that packs get given a \"generation\",\n>> and that the number of packs in each generation (except the last one)\n>> is bounded.\n> \n> Please explain again why this should be useful and is worth the \n> complexity it brings along.  Last time this was discussed I wasn't \n> convinced at all, and I'm still not convinced this time either.\n\nFirst I think we should establish some common ground.\n\n1. Do you agree that some users would want their git repositories to be\n\"maintenance free\"?\n\n2. Do you agree that having thousands of packs would add measurable\noverhead?\n\nSam.\n"},{"id":"46373","messageId":"alpine.LFD.0.999.0707031020300.26459@xanadu.home","threadId":"8780","inReplyTo":"4689D77D.20601@vilain.net","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-07-03T14:45:03Z","receivedAt":"2007-07-03T14:45:03Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Tue, 3 Jul 2007, Sam Vilain wrote:\n\n> Nicolas Pitre wrote:\n> >> Add an option to git-repack that makes the repack run suitable for\n> >> running very often.  The idea is that packs get given a \"generation\",\n> >> and that the number of packs in each generation (except the last one)\n> >> is bounded.\n> > \n> > Please explain again why this should be useful and is worth the \n> > complexity it brings along.  Last time this was discussed I wasn't \n> > convinced at all, and I'm still not convinced this time either.\n> \n> First I think we should establish some common ground.\n> \n> 1. Do you agree that some users would want their git repositories to be\n> \"maintenance free\"?\n\nI'm not so sure.  I think it is best to let GIT users know (or the \nadmins on their behalf) how to properly maintain their repository than \npretending that it needs no maintenance.  GIT is a tool for \"developers\" \nafter all, not for Aunt Tillie.\n\nAnd even if your developers are completely inept to the point of not \nwanting to run 'git gc' once a week for example, or once a day if \nthey're otherwise really really productive, I'm sure you can automate \nsome of that maintenance asynchronously from a simple post commit hook \nor something, based on the output of 'git count-objects -v'.\n\n> 2. Do you agree that having thousands of packs would add measurable\n> overhead?\n\nSure it would, but far less as it used to when we last discussed this \nsince performances in those cases has been improved significantly.\n\nAnd if you end up with thousands of packs in the first place I think you \nhave a more fundamental problem to fix, something that generational \nrepacking would just paper over.\n\n\nNicolas\n"},{"id":"46375","messageId":"20070703145552.GG4495@spearce.org","threadId":"8780","inReplyTo":"alpine.LFD.0.999.0707031020300.26459@xanadu.home","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-07-03T14:55:52Z","receivedAt":"2007-07-03T14:55:52Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Nicolas Pitre <nico@cam.org> wrote:\n> And even if your developers are completely inept to the point of not \n> wanting to run 'git gc' once a week for example, or once a day if \n> they're otherwise really really productive, I'm sure you can automate \n> some of that maintenance asynchronously from a simple post commit hook \n> or something, based on the output of 'git count-objects -v'.\n\nYea, you need not just the loose object count but also the number\nof packfiles.  git-gui suggests repacking based on loose object\ncount alone right now, but with us keeping fetched packfiles by\ngit-index-pack I found a repository on my desktop the other day\nthat had 30 packfiles in it.  I need to fix that in git-gui and\nalso add a limit based on the number of small-ish packfiles present.\n\nBTW, I have some users that might as well be Aunt Tillie.  They\nmerge any branch they can find.  \"Oh, look, there's a new branch\ncalled Highly-Experimental!  I'll bet that's good for merging too!\"\n\nAsking them to also run git-gc once in a while is like asking them\nto actually do their job or something...  *sighs* OK, I have to go\nto work and undo that Highly-Experimental merge I found last night.\n*sigh*\n \n-- \nShawn.\n"},{"id":"46425","messageId":"468AE462.1040202@vilain.net","threadId":"8780","inReplyTo":"alpine.LFD.0.999.0707031020300.26459@xanadu.home","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-07-04T00:05:54Z","receivedAt":"2007-07-04T00:05:54Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Nicolas Pitre wrote:\n>> 1. Do you agree that some users would want their git repositories to be\n>> \"maintenance free\"?\n>\n> I'm not so sure.\n\nWell, no offence, but I think you should withhold from voicing a\nfundamental concern as this, because you're not one of its target users.\n\nI'd be more than happy to reshape the patch so that it does not\nintroduce this \"complexity\" into the current code path.  Potentially it\ncould entirely fit into the post-commit hook, which should not upset\nanybody as they don't have to turn it on.  I just noticed that the\n\"repack -a\" code path was already doing a lot of what a generational\nrepack would have to do, so thought I'd re-use the code.\n\nOf course your critical analysis of code is more than welcome.\n\n> And even if your developers are completely inept to the point of not \n> wanting to run 'git gc' once a week for example, \n\nThis kind of characterisation does not help the discussion.\n\n> I'm sure you can automate \n> some of that maintenance asynchronously from a simple post commit hook \n> or something, based on the output of 'git count-objects -v'.\n\nYet another little command that I didn't know about that could make the\n patch simpler.\n\nPotentially the calculations could be performed in count-objects.  I'll\ninvestigate that.\n\n>> 2. Do you agree that having thousands of packs would add measurable\n>> overhead?\n> \n> Sure it would, but far less as it used to when we last discussed this \n> since performances in those cases has been improved significantly.\n\nFar less for examining recent history.  It would however make examining\nolder history, and potentially blame operations slower.  Just how much\nslower I don't know, but I'd guess that random access with 1000 small\nindices scanned sequentially is slower than with 10 larger indices.\n\n> And if you end up with thousands of packs in the first place I think you \n> have a more fundamental problem to fix, something that generational \n> repacking would just paper over.\n\nRight, but only if you are of the opinion that a repack is something\nthat is best run off-line from normal work flow.  If you want it to run\nin-line, then the fundamental problem would be \"a simple operation now\ntakes much longer because a huge repack is occurring\".\n\nSo I think this fundamental decision is more of a user preference.\n\nSam.\n"},{"id":"46427","messageId":"Pine.LNX.4.64.0707040155240.4071@racer.site","threadId":"8780","inReplyTo":"468AE462.1040202@vilain.net","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-04T01:01:40Z","receivedAt":"2007-07-04T01:01:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 4 Jul 2007, Sam Vilain wrote:\n\n> Nicolas Pitre wrote:\n> >> 1. Do you agree that some users would want their git repositories to be\n> >> \"maintenance free\"?\n> >\n> > I'm not so sure.\n> \n> Well, no offence, but I think you should withhold from voicing a\n> fundamental concern as this, because you're not one of its target users.\n\nLet's put it this way. A lot of car drivers would probably agree that it \nis a Good Thing (tm) if their car automatically went to get gas, before it \nran out of it. Less hassle, right?\n\nYes, except if your car decides to get gas when you are already late, \nspeeding, trying to catch your plane.\n\nSame holds for Git. Is is worth the hassle having to wait for this \nautomatic git-gc when your boss is waiting impatiently for you to show \nsome results?\n\nNow, you seem to argue that the cost of a single git-gc should be \ndecreased. But I maintain that the _usefulness_ of git-gc is decreased \nthat way, too.\n\nIn all of my projects, the most efficient setup is one big pack. That is \nwhy I set up some cronjobs on the machines that run 24/7, and that is why \nI run \"git-gc --prune\" when idling, on almost all my repos.\n\nCiao,\nDscho\n"},{"id":"46444","messageId":"468B3B42.2040103@vilain.net","threadId":"8780","inReplyTo":"Pine.LNX.4.64.0707040155240.4071@racer.site","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-07-04T06:16:34Z","receivedAt":"2007-07-04T06:16:34Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Johannes Schindelin wrote:\n>>>> 1. Do you agree that some users would want their git repositories to be\n>>>> \"maintenance free\"?\n>>> I'm not so sure.\n>> Well, no offence, but I think you should withhold from voicing a\n>> fundamental concern as this, because you're not one of its target users.\n> Let's put it this way. A lot of car drivers would probably agree that it \n> is a Good Thing (tm) if their car automatically went to get gas, before it \n> ran out of it. Less hassle, right?\n> \n> Yes, except if your car decides to get gas when you are already late, \n> speeding, trying to catch your plane.\n\nOk, but if you're only packing a few hundred objects it usually won't\nmatter because it is fast enough that you hardly notice.\n\nAnd if you don't like it, you turn it off, or don't turn it on.\n\nSam.\n"},{"id":"46445","messageId":"81b0412b0707040002k5afb1851kdc6581192a7a4191@mail.gmail.com","threadId":"8780","inReplyTo":"468B3B42.2040103@vilain.net","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-07-04T07:02:13Z","receivedAt":"2007-07-04T07:02:13Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/4/07, Sam Vilain <sam@vilain.net> wrote:\n> Johannes Schindelin wrote:\n> >>>> 1. Do you agree that some users would want their git repositories to be\n> >>>> \"maintenance free\"?\n> >>> I'm not so sure.\n> >> Well, no offence, but I think you should withhold from voicing a\n> >> fundamental concern as this, because you're not one of its target users.\n> > Let's put it this way. A lot of car drivers would probably agree that it\n> > is a Good Thing (tm) if their car automatically went to get gas, before it\n> > ran out of it. Less hassle, right?\n> >\n> > Yes, except if your car decides to get gas when you are already late,\n> > speeding, trying to catch your plane.\n>\n> Ok, but if you're only packing a few hundred objects it usually won't\n> matter because it is fast enough that you hardly notice.\n\nUnless you are on Windows, MacOSX, a notebook with P233, or unless\nit is your home server in cellar built out of decommissioned desktop\n(trusty old P133 with reasonable (for such a thing) 256Mb).\n"},{"id":"46492","messageId":"alpine.LFD.0.999.0707041127130.26459@xanadu.home","threadId":"8780","inReplyTo":"468B3B42.2040103@vilain.net","subject":"Re: [PATCH] git-repack: generational repacking (and example hook script)","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-07-04T15:42:22Z","receivedAt":"2007-07-04T15:42:22Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 4 Jul 2007, Sam Vilain wrote:\n\n> Johannes Schindelin wrote:\n> >>>> 1. Do you agree that some users would want their git repositories to be\n> >>>> \"maintenance free\"?\n> >>> I'm not so sure.\n> >> Well, no offence, but I think you should withhold from voicing a\n> >> fundamental concern as this, because you're not one of its target users.\n> > Let's put it this way. A lot of car drivers would probably agree that it \n> > is a Good Thing (tm) if their car automatically went to get gas, before it \n> > ran out of it. Less hassle, right?\n> > \n> > Yes, except if your car decides to get gas when you are already late, \n> > speeding, trying to catch your plane.\n> \n> Ok, but if you're only packing a few hundred objects it usually won't\n> matter because it is fast enough that you hardly notice.\n\n... in which case you might as well keep them loose too.\n\n> And if you don't like it, you turn it off, or don't turn it on.\n\nYou seem to forget the maintenance cost of having this in the Git \ndistribution.  When something is merged in, it has to be maintained and \nkept working.  Given the complexity of your proposal weighted against \nthe relative benefits I remain unconvinced.\n\nYet you didn't state what exactly is the issue you're trying to solve.  \nIf it is only to avoid running \"git gc\" occasionally then this clearly \nisn't a benefit worth the cost.\n\nIf, instead, you implement it as a post-commit or post-receive hook \nmeant for contrib/hooks/ then I wouldn't have any issue with that.\n\n\nNicolas\n"},{"id":"47022","messageId":"f72cki$ke6$2@sea.gmane.org","threadId":"8780","inReplyTo":"11831937823982-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] GIT-VERSION-GEN: don't convert - delimiter to .'s","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-07-11T10:49:54Z","receivedAt":"2007-07-11T10:49:54Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Sam Vilain wrote:\n\n> Otherwise, a custom \"v1.5.2.42.gb1ff\" is considered newer than a\n> \"v1.5.2.1.69.gcafe\"\n\nWouldn't it be better to do what tig did, namely put the extra part,\ni.e. the number of commits since tagged revision and shortened sha1 into\nREVISION rather than VERSION for an rpm for example?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}