{"thread":{"id":"27706","subject":"[PATCH 1/6] rebase -i: Add the \"ref\" command","startedAt":"2009-10-10T02:52:00Z","lastAt":"2011-08-03T22:31:11Z","messageCount":24,"participants":["Greg Price","Phil Hord","Junio C Hamano","Ramkumar Ramachandra","Sverre Rabbelier"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"170563","messageId":"186680ca6febeb231e9a4fb44cee1e6aff58db6c.1309133817.git.greg@quora.com","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"[PATCH 1/6] rebase -i: Add the \"ref\" command","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2009-10-10T02:52:00Z","receivedAt":"2009-10-10T02:52:00Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"This is useful for, e.g., rewriting a branch that has ancestor\nbranches along the way.\n\nSigned-off-by: Greg Price <price@mit.edu>\n---\n Documentation/git-rebase.txt |    4 ++++\n git-rebase--interactive.sh   |   12 ++++++++++++\n git-rebase.sh                |   11 +++++++++++\n 3 files changed, 27 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 9a075bc..74fda58 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -455,6 +455,10 @@ message for the folded commit is the concatenation of the commit\n messages of the first commit and of those with the \"squash\" command,\n but omits the commit messages of commits with the \"fixup\" command.\n \n+If you want to update a ref to point to a rewritten commit, add a\n+command \"ref <refname>\" after the \"pick\", \"edit\", or other command\n+that produces the commit.\n+\n 'git rebase' will stop when \"pick\" has been replaced with \"edit\" or\n when a command fails due to merge errors. When you are done editing\n and/or resolving conflicts you can continue with `git rebase --continue`.\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 65690af..cec9cab 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -418,6 +418,17 @@ do_next () {\n \t\twarn\n \t\texit 0\n \t\t;;\n+\tref)\n+\t\tmark_action_done\n+\t\trefname=$sha1\n+\t\tsha1=$(git rev-parse --quiet --verify \"$refname\" \\\n+\t\t\t|| echo \"(null)\")\n+\t\tif ! grep -Fq \" $refname\" \"$state_dir\"/oldrefs 2>/dev/null\n+\t\tthen\n+\t\t\techo \"$sha1 $refname\" >> \"$state_dir\"/oldrefs\n+\t\tfi\n+\t\tgit update-ref $refname HEAD\n+\t\t;;\n \tsquash|s|fixup|f)\n \t\tcase \"$command\" in\n \t\tsquash|s)\n@@ -801,6 +812,7 @@ cat >> \"$todo\" << EOF\n #  s, squash = use commit, but meld into previous commit\n #  f, fixup = like \"squash\", but discard this commit's log message\n #  x, exec = run command (the rest of the line) using shell\n+#  ref <refname> = update ref\n #\n # If you remove a line here THAT COMMIT WILL BE LOST.\n # However, if you remove everything, the rebase will be aborted.\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex d7855ea..1bfe6a8 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -118,6 +118,8 @@ read_basic_state () {\n \t\tstrategy_opts=\"$(cat \"$state_dir\"/strategy_opts)\"\n \ttest -f \"$state_dir\"/allow_rerere_autoupdate &&\n \t\tallow_rerere_autoupdate=\"$(cat \"$state_dir\"/allow_rerere_autoupdate)\"\n+\ttest -f \"$state_dir\"/oldrefs &&\n+\t\toldrefs=\"$(cat \"$state_dir\"/oldrefs)\"\n }\n \n write_basic_state () {\n@@ -332,6 +334,15 @@ skip)\n abort)\n \tgit rerere clear\n \tread_basic_state\n+\t[ -n \"$oldrefs\" ] && echo \"$oldrefs\" | while read sha1 ref\n+\tdo\n+\t\tif test \"(null)\" = $sha1\n+\t\tthen\n+\t\t\tgit update-ref -d \"$ref\"\n+\t\telse\n+\t\t\tgit update-ref \"$ref\" $sha1\n+\t\tfi\n+\tdone\n \tcase \"$head_name\" in\n \trefs/*)\n \t\tgit symbolic-ref -m \"rebase: aborting\" HEAD $head_name ||\n-- \n1.7.5.4\n"},{"id":"170567","messageId":"9d9e18b8c062380025f52a6ff992fae51a17f5d1.1309133817.git.greg@quora.com","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"[PATCH 2/6] pretty: Add %D for script-friendly decoration","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2009-11-18T23:22:17Z","receivedAt":"2009-11-18T23:22:17Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"When in a script or porcelain one wants to identify what refs point to\nwhich commits in a series, the functionality of 'git log --decorate'\nis extremely useful.  This is available with the %d format code in a\nform optimized for humans, but for scripts a more raw format is better.\nMake such a format available through a new format code %D.\n\nSigned-off-by: Greg Price <price@mit.edu>\n---\n Documentation/pretty-formats.txt |    1 +\n pretty.c                         |   33 +++++++++++++++++++++++++--------\n 2 files changed, 26 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 561cc9f..217f11b 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -124,6 +124,7 @@ The placeholders are:\n - '%ct': committer date, UNIX timestamp\n - '%ci': committer date, ISO 8601 format\n - '%d': ref names, like the --decorate option of linkgit:git-log[1]\n+- '%D': full ref names, like the --decorate=full option of linkgit:git-log[1]\n - '%e': encoding\n - '%s': subject\n - '%f': sanitized subject line, suitable for a filename\ndiff --git a/pretty.c b/pretty.c\nindex f45eb54..0c7e723 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -776,21 +776,35 @@ static void parse_commit_message(struct format_commit_context *c)\n \tc->commit_message_parsed = 1;\n }\n \n-static void format_decoration(struct strbuf *sb, const struct commit *commit)\n+\n+static void format_decoration(struct strbuf *sb, const struct commit *commit,\n+\t\t\t      int decoration_style, const char *affixes[3])\n {\n \tstruct name_decoration *d;\n-\tconst char *prefix = \" (\";\n+\tconst char *affix = affixes[0];\n \n-\tload_ref_decorations(DECORATE_SHORT_REFS);\n+\tload_ref_decorations(decoration_style);\n \td = lookup_decoration(&name_decoration, &commit->object);\n \twhile (d) {\n-\t\tstrbuf_addstr(sb, prefix);\n-\t\tprefix = \", \";\n+\t\tstrbuf_addstr(sb, affix);\n+\t\taffix = affixes[1];\n \t\tstrbuf_addstr(sb, d->name);\n \t\td = d->next;\n \t}\n-\tif (prefix[0] == ',')\n-\t\tstrbuf_addch(sb, ')');\n+\tif (affix == affixes[1])\n+\t\tstrbuf_addstr(sb, affixes[2]);\n+}\n+\n+static void format_decoration_short(struct strbuf *sb, const struct commit *commit)\n+{\n+\tconst char *affixes[3] = {\" (\", \", \", \")\"};\n+\tformat_decoration(sb, commit, DECORATE_SHORT_REFS, affixes);\n+}\n+\n+static void format_decoration_full(struct strbuf *sb, const struct commit *commit)\n+{\n+\tconst char *affixes[3] = {\"\", \" \", \"\"};\n+\tformat_decoration(sb, commit, DECORATE_FULL_REFS, affixes);\n }\n \n static void strbuf_wrap(struct strbuf *sb, size_t pos,\n@@ -947,7 +961,10 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,\n \t\tstrbuf_addstr(sb, get_revision_mark(NULL, commit));\n \t\treturn 1;\n \tcase 'd':\n-\t\tformat_decoration(sb, commit);\n+\t\tformat_decoration_short(sb, commit);\n+\t\treturn 1;\n+\tcase 'D':\n+\t\tformat_decoration_full(sb, commit);\n \t\treturn 1;\n \tcase 'g':\t\t/* reflog info */\n \t\tswitch(placeholder[1]) {\n-- \n1.7.5.4\n"},{"id":"170568","messageId":"c2d11ffe876a540b6fad46e2ecc57a24018cfb73.1309133817.git.greg@quora.com","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"[PATCH 4/6] rebase: --rewrite-{refs,heads,tags} to pull refs along with branch","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2009-11-18T23:51:11Z","receivedAt":"2009-11-18T23:51:11Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"The new option --rewrite-refs causes the TODO file to contain a \"ref\"\ncommand for each appropriate ref pointing to a selected commit, other\nthan the one we are already rebasing.  The argument to --rewrite-refs\nis a ref pattern of the same type accepted by for-each-ref: a pattern\nmatches a ref name if it matches exactly, matches exactly up to a\nslash, or matches according to fnmatch(3).  The options\n--rewrite-heads and --rewrite-tags are supplied as shortcuts.\n\nThe effect of this is that when a branch contains intermediate\nbranches, like so:\n\n      part1 part2 topic\n        |     |     |\n        v     v     v\n  A--*--*--*--*--*--*\n   \\\n    B <--master\n\na single command like \"git rebase --rewrite-heads master topic\"\nsuffices to rewrite all the heads that are part of the topic, like so:\n\n        part1 part2 topic\n  A       |     |     |\n   \\      v     v     v\n    B--*--*--*--*--*--*\n    ^\n    |\n    master\n\nSigned-off-by: Greg Price <price@mit.edu>\n---\n Documentation/git-rebase.txt |   13 ++++++++++++-\n git-rebase--interactive.sh   |   25 ++++++++++++++++++++++++-\n git-rebase.sh                |   17 +++++++++++++++++\n 3 files changed, 53 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 74fda58..e4f32fc 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -347,6 +347,15 @@ idea unless you know what you are doing (see BUGS below).\n \troot commits will be rewritten to have <newbase> as parent\n \tinstead.\n \n+--rewrite-refs=<pattern>::\n+--rewrite-heads::\n+--rewrite-tags::\n+\tRewrite refs matching <pattern> which point to the rebased\n+\tcommits.  The options --rewrite-heads and --rewrite-tags are\n+\tshortcuts for --rewrite-refs=refs/heads and\n+\t--rewrite-refs=refs/tags respectively.  Ref patterns are\n+\tinterpreted as in linkgit:git-for-each-ref[1].\n+\n --autosquash::\n --no-autosquash::\n \tWhen the commit log message begins with \"squash! ...\" (or\n@@ -457,7 +466,9 @@ but omits the commit messages of commits with the \"fixup\" command.\n \n If you want to update a ref to point to a rewritten commit, add a\n command \"ref <refname>\" after the \"pick\", \"edit\", or other command\n-that produces the commit.\n+that produces the commit.  You can use the --rewrite-refs option to\n+have the file start out with these commands for refs inside the branch\n+you are rebasing.\n \n 'git rebase' will stop when \"pick\" has been replaced with \"edit\" or\n when a command fails due to merge errors. When you are done editing\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex cec9cab..42ea3e7 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -741,12 +741,23 @@ else\n \trevisions=$onto...$orig_head\n \tshortrevisions=$shorthead\n fi\n-git rev-list $merges_option --pretty=oneline --abbrev-commit \\\n+if test -z \"rewrite_refs\"\n+then\n+\tpretty=oneline\n+else\n+\tpretty=format:\"%m%h %s%n%m%D\"\n+fi\n+git rev-list $merges_option --pretty=\"$pretty\" --abbrev-commit \\\n \t--abbrev=7 --reverse --left-right --topo-order \\\n \t$revisions | \\\n \tsed -n \"s/^>//p\" |\n while read -r shortsha1 rest\n do\n+\tif test -n \"$rewrite_refs\"\n+\tthen\n+\t\tread refs\n+\tfi\n+\n \tif test t != \"$preserve_merges\"\n \tthen\n \t\tprintf '%s\\n' \"pick $shortsha1 $rest\" >> \"$todo\"\n@@ -771,6 +782,18 @@ do\n \t\t\tprintf '%s\\n' \"pick $shortsha1 $rest\" >> \"$todo\"\n \t\tfi\n \tfi\n+\n+\tif test -n \"$rewrite_refs\"\n+\tthen\n+\t\tfor ref in $refs; do echo \"$ref\"; done | \\\n+\t\tgit for-each-ref --stdin $rewrite_refs \\\n+\t\t\t--format '%(refname)' | \\\n+\t\twhile read ref\n+\t\tdo\n+\t\t\ttest \"$ref\" != \"$head_name\" &&\n+\t\t\techo \"ref $ref\" >> \"$todo\"\n+\t\tdone\n+\tfi\n done\n \n # Watch for commits that been dropped by --cherry-pick\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 1bfe6a8..7c365ab 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -38,6 +38,9 @@ git-rebase [-i] --continue | --abort | --skip\n v,verbose!         display a diffstat of what changed upstream\n q,quiet!           be quiet. implies --no-stat\n onto=!             rebase onto given branch instead of upstream\n+rewrite-heads!     rewrite intermediate heads on branch\n+rewrite-tags!      rewrite intermediate tags on branch\n+rewrite-refs=!     rewrite intermediate refs matching pattern\n p,preserve-merges! try to recreate merges instead of ignoring them\n s,strategy=!       use the given merge strategy\n no-ff!             cherry-pick all commits, even if unchanged\n@@ -96,6 +99,7 @@ state_dir=\n # One of {'', continue, skip, abort}, as parsed from command line\n action=\n preserve_merges=\n+rebase_refs=\n autosquash=\n test \"$(git config --bool rebase.autosquash)\" = \"true\" && autosquash=t\n \n@@ -246,6 +250,19 @@ do\n \t\tstrategy=\"$1\"\n \t\tdo_merge=t\n \t\t;;\n+\t--rewrite-refs)\n+\t\tshift\n+\t\trewrite_refs=\"$rewrite_refs $1\"\n+\t\ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n+\t\t;;\n+\t--rewrite-heads)\n+\t\trewrite_refs=\"$rewrite_refs refs/heads\"\n+\t\ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n+\t\t;;\n+\t--rewrite-tags)\n+\t\trewrite_refs=\"$rewrite_refs refs/tags\"\n+\t\ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n+\t\t;;\n \t-n)\n \t\tdiffstat=\n \t\t;;\n-- \n1.7.5.4\n"},{"id":"170565","messageId":"47cee601ac5a3b8938b902b173cbaf4146e0d657.1309133817.git.greg@quora.com","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"[PATCH 3/6] for-each-ref: --stdin to match specified refs against pattern","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2010-01-07T23:08:28Z","receivedAt":"2010-01-07T23:08:28Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"The pattern syntax of for-each-ref is handy for users, but a bit subtle:\na pattern matches a ref if it matches as an fnmatch pattern, or literally,\nor literally against a prefix of the refname up to a slash.  Expose the\nfor-each-ref pattern-matcher for scripts to use, so that they can provide\na consistent user interface without duplicating the implementation.\n\nSigned-off-by: Greg Price <price@mit.edu>\n---\n builtin/for-each-ref.c |   22 ++++++++++++++++++++--\n 1 files changed, 20 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex 89e75c6..0413ec0 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -779,6 +779,20 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f\n \treturn 0;\n }\n \n+static void for_each_ref_stdin(each_ref_fn fn, void *cb_data)\n+{\n+\tstruct strbuf buf;\n+\tunsigned char sha1[20];\n+\n+\tstrbuf_init(&buf, 0);\n+\twhile (strbuf_getline(&buf, stdin, '\\n') != EOF) {\n+\t\tif (read_ref(buf.buf, sha1))\n+\t\t\tcontinue;\n+\t\tfn(buf.buf, sha1, 0, cb_data);\n+\t}\n+\tstrbuf_release(&buf);\n+}\n+\n static int cmp_ref_sort(struct ref_sort *s, struct refinfo *a, struct refinfo *b)\n {\n \tstruct atom_value *va, *vb;\n@@ -943,7 +957,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)\n \tint i, num_refs;\n \tconst char *format = \"%(objectname) %(objecttype)\\t%(refname)\";\n \tstruct ref_sort *sort = NULL, **sort_tail = &sort;\n-\tint maxcount = 0, quote_style = 0;\n+\tint maxcount = 0, quote_style = 0, stdin_refs = 0;\n \tstruct refinfo **refs;\n \tstruct grab_ref_cbdata cbdata;\n \n@@ -962,6 +976,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)\n \t\tOPT_STRING(  0 , \"format\", &format, \"format\", \"format to use for the output\"),\n \t\tOPT_CALLBACK(0 , \"sort\", sort_tail, \"key\",\n \t\t            \"field name to sort on\", &opt_parse_sort),\n+\t\tOPT_BOOLEAN( 0 , \"stdin\", &stdin_refs, \"read candidate refs from stdin, rather than all refs\"),\n \t\tOPT_END(),\n \t};\n \n@@ -986,7 +1001,10 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)\n \n \tmemset(&cbdata, 0, sizeof(cbdata));\n \tcbdata.grab_pattern = argv;\n-\tfor_each_rawref(grab_single_ref, &cbdata);\n+\tif (stdin_refs)\n+\t\tfor_each_ref_stdin(grab_single_ref, &cbdata);\n+\telse\n+\t\tfor_each_rawref(grab_single_ref, &cbdata);\n \trefs = cbdata.grab_array;\n \tnum_refs = cbdata.grab_cnt;\n \n-- \n1.7.5.4\n"},{"id":"170569","messageId":"f4dd1c56260f7fe4750779769ecc349e206b0f01.1309133817.git.greg@quora.com","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"[PATCH 5/6] t/lib-rebase.sh: pass through ref commands","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2010-01-25T02:26:25Z","receivedAt":"2010-01-25T02:26:25Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"Signed-off-by: Greg Price <price@mit.edu>\n---\n t/lib-rebase.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 6ccf797..656e4b6 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -54,7 +54,7 @@ for line in $FAKE_LINES; do\n \t\">\")\n \t\techo >> \"$1\";;\n \t*)\n-\t\tsed -n \"${line}s/^pick/$action/p\" < \"$1\".tmp >> \"$1\"\n+\t\tsed -n \"${line}{s/^pick/$action/p; /^ref/p}\" < \"$1\".tmp >> \"$1\"\n \t\taction=pick;;\n \tesac\n done\n-- \n1.7.5.4\n"},{"id":"170566","messageId":"ab6d17ba0ea919e0f873597b60d6c7e9a43460c8.1309133817.git.greg@quora.com","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"[PATCH 6/6] rebase --rewrite-refs: tests","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2010-01-25T02:28:48Z","receivedAt":"2010-01-25T02:28:48Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"Signed-off-by: Greg Price <price@mit.edu>\n---\n t/t3420-rebase-ref.sh |   75 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 75 insertions(+), 0 deletions(-)\n create mode 100644 t/t3420-rebase-ref.sh\n\ndiff --git a/t/t3420-rebase-ref.sh b/t/t3420-rebase-ref.sh\nnew file mode 100644\nindex 0000000..601a434\n--- /dev/null\n+++ b/t/t3420-rebase-ref.sh\n@@ -0,0 +1,75 @@\n+#!/bin/sh\n+\n+test_description='git rebase --rewrite-refs'\n+\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY/lib-rebase.sh\"\n+set_fake_editor\n+\n+#      part1  part2 topic\n+#\t |\t|     |\n+#\t v\tv     v\n+#  A-----C------D-----E\n+#   \\\n+#    B <--master\n+\n+test_expect_success setup '\n+\ttest_commit A &&\n+\tgit branch topic &&\n+\ttest_commit B &&\n+\tgit checkout topic &&\n+\ttest_commit C &&\n+\tgit branch part1 &&\n+\ttest_commit D\n+\tgit branch part2 &&\n+\ttest_commit E\n+'\n+\n+test_expect_success 'rebase --rewrite-heads' '\n+\tgit reset --hard &&\n+\tgit checkout topic &&\n+\tgit reset --hard E &&\n+\n+\tgit rebase --rewrite-heads master &&\n+\tgit rev-parse part1 >actual &&\n+\tgit rev-parse HEAD~2 >expected &&\n+\ttest_cmp expected actual &&\n+\tgit rev-parse part2 >actual &&\n+\tgit rev-parse HEAD~1 >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'rebase --rewrite-refs' '\n+\tgit reset --hard &&\n+\tgit update-ref refs/heads/part1 C &&\n+\tgit update-ref refs/heads/part2 D &&\n+\tgit checkout topic &&\n+\tgit reset --hard E &&\n+\n+\tgit rebase --rewrite-refs=refs/heads/part2 master &&\n+\tgit rev-parse part1 >actual &&\n+\tgit rev-parse C >expected &&\n+\ttest_cmp expected actual &&\n+\tgit rev-parse part2 >actual &&\n+\tgit rev-parse HEAD~1 >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'ref in TODO followed by rebase --abort' '\n+\tgit reset --hard &&\n+\tgit update-ref refs/heads/part1 C &&\n+\tgit update-ref refs/heads/part2 D &&\n+\tgit checkout topic &&\n+\tgit reset --hard E &&\n+\n+\tFAKE_LINES=\"1 2 edit 3 4 5\" git rebase -i --rewrite-heads master &&\n+\tgit rev-parse part1 >actual &&\n+\tgit rev-parse HEAD^ >expected &&\n+\ttest_cmp expected actual &&\n+\tgit rebase --abort &&\n+\tgit rev-parse part1 >actual &&\n+\tgit rev-parse C >expected &&\n+\ttest_cmp expected actual\n+'\n+\n+test_done\n-- \n1.7.5.4\n"},{"id":"170564","messageId":"cover.1309133817.git.greg@quora.com","threadId":"27706","inReplyTo":null,"subject":"[PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Greg Price","fromEmail":"greg@quora.com","sentAt":"2011-06-27T00:16:57Z","receivedAt":"2011-06-27T00:16:57Z","isPatch":true,"sender":{"key":"greg@quora.com","avatar":null},"body":"This series adds a \"ref\" command to rebase -i, and options\n--rewrite-{refs,heads,tags} to generate \"ref\" commands in the original\nTODO file.  This makes it easy to rebase a branch together with\nintermediate markers, or a series of branches.\n\nFor example, in this situation:\n\n      part1 part2 topic\n        |     |     |\n        v     v     v\n  A--*--*--*--*--*--*\n   \\\n    B <--master\n\nwe may want to rebase 'topic' onto the new master, rewriting the\nintermediate branches 'part1', 'part2' to the corresponding new\ncommits.  This can be done with a sequence of \"git rebase --onto\"\ncommands, but it's tricky to get right.\n\nWith this series, the command\n  $ git rebase --rewrite-heads master topic\nsuffices to produce this result:\n\n        part1 part2 topic\n  A       |     |     |\n   \\      v     v     v\n    B--*--*--*--*--*--*\n    ^\n    |\n    master\n\n\nI originally submitted a version of this series nearly a year and a\nhalf ago [1].  This version has been rebased to the new release 1.7.6\n(Martin von Zweigbergk's cleanups gave me quite some conflicts to\nresolve, but are nevertheless much appreciated!) and the interface has\nbeen adjusted for the comments of Junio and others [2].  The general\ncommand is --rewrite-refs=PATTERN; --rewrite-heads and --rewrite-tags\nare provided as shortcuts, the former being equivalent to the --refs\nof my original proposal.\n\n [1]  http://www.amailbox.net/mailarchive/git/2009/12/22/18967\n [2]  http://www.amailbox.net/mailarchive/git/2009/12/22/18972\n\nI have no excuse for the year and a half of delay in submitting the\nrevised version, but I believe that late is better than never. =)\n\n\nThe series contains two preparatory patches that are independently useful:\n  pretty: Add %D for script-friendly decoration\n  for-each-ref: --stdin to match specified refs against pattern\nEach one exposes a bit more knowledge of the repository in a\nmachine-readable form convenient for scripting.  I hope other people\nmay find them useful in writing other scripts.\n\nGreg\n\n\n---\nGreg Price (6):\n  rebase -i: Add the \"ref\" command\n  pretty: Add %D for script-friendly decoration\n  for-each-ref: --stdin to match specified refs against pattern\n  rebase: --rewrite-{refs,heads,tags} to pull refs along with branch\n  t/lib-rebase.sh: pass through ref commands\n  rebase --rewrite-refs: tests\n\n Documentation/git-rebase.txt     |   15 ++++++++\n Documentation/pretty-formats.txt |    1 +\n builtin/for-each-ref.c           |   22 ++++++++++-\n git-rebase--interactive.sh       |   37 ++++++++++++++++++-\n git-rebase.sh                    |   28 ++++++++++++++\n pretty.c                         |   33 +++++++++++++----\n t/lib-rebase.sh                  |    2 +-\n t/t3420-rebase-ref.sh            |   75 ++++++++++++++++++++++++++++++++++++++\n 8 files changed, 201 insertions(+), 12 deletions(-)\n create mode 100644 t/t3420-rebase-ref.sh\n\n-- \n1.7.5.4\n"},{"id":"170575","messageId":"4E08AAAE.5020604@cisco.com","threadId":"27706","inReplyTo":"ab6d17ba0ea919e0f873597b60d6c7e9a43460c8.1309133817.git.greg@quora.com","subject":"Re: [PATCH 6/6] rebase --rewrite-refs: tests","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2011-06-27T16:07:10Z","receivedAt":"2011-06-27T16:07:10Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"\n\nOn 01/24/2010 09:28 PM, Greg Price wrote:\n> Signed-off-by: Greg Price <price@mit.edu>\n> ---\n>  t/t3420-rebase-ref.sh |   75 +++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 files changed, 75 insertions(+), 0 deletions(-)\n>  create mode 100644 t/t3420-rebase-ref.sh\n>\n> diff --git a/t/t3420-rebase-ref.sh b/t/t3420-rebase-ref.sh\n> new file mode 100644\n> index 0000000..601a434\n> --- /dev/null\n> +++ b/t/t3420-rebase-ref.sh\n> @@ -0,0 +1,75 @@\n> +#!/bin/sh\n> +\n> +test_description='git rebase --rewrite-refs'\n> +\n> +. ./test-lib.sh\n> +. \"$TEST_DIRECTORY/lib-rebase.sh\"\n> +set_fake_editor\n> +\n> +#      part1  part2 topic\n> +#\t |\t|     |\n> +#\t v\tv     v\n> +#  A-----C------D-----E\n> +#   \\\n> +#    B <--master\n> +\n> +test_expect_success setup '\n> +\ttest_commit A &&\n> +\tgit branch topic &&\n> +\ttest_commit B &&\n> +\tgit checkout topic &&\n> +\ttest_commit C &&\n> +\tgit branch part1 &&\n> +\ttest_commit D\n> +\tgit branch part2 &&\n> +\ttest_commit E\n> +'\n\nI think there is a missing \"&&\" at the end of \"test_commit D\".  But it's\npossible I just don't understand the test machinery enough to know this\nis normal.  Can you explain to me the difference in that case?\n\nPhil\n"},{"id":"170574","messageId":"4E08ABBB.9060009@cisco.com","threadId":"27706","inReplyTo":"c2d11ffe876a540b6fad46e2ecc57a24018cfb73.1309133817.git.greg@quora.com","subject":"Re: [PATCH 4/6] rebase: --rewrite-{refs,heads,tags} to pull refs along with branch","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2011-06-27T16:11:39Z","receivedAt":"2011-06-27T16:11:39Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On 11/18/2009 06:51 PM, Greg Price wrote:\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 1bfe6a8..7c365ab 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -38,6 +38,9 @@ git-rebase [-i] --continue | --abort | --skip\n>  v,verbose!         display a diffstat of what changed upstream\n>  q,quiet!           be quiet. implies --no-stat\n>  onto=!             rebase onto given branch instead of upstream\n> +rewrite-heads!     rewrite intermediate heads on branch\n> +rewrite-tags!      rewrite intermediate tags on branch\n> +rewrite-refs=!     rewrite intermediate refs matching pattern\n>  p,preserve-merges! try to recreate merges instead of ignoring them\n>  s,strategy=!       use the given merge strategy\n>  no-ff!             cherry-pick all commits, even if unchanged\n> @@ -96,6 +99,7 @@ state_dir=\n>  # One of {'', continue, skip, abort}, as parsed from command line\n>  action=\n>  preserve_merges=\n> +rebase_refs=\n>  autosquash=\n>  test \"$(git config --bool rebase.autosquash)\" = \"true\" && autosquash=t\nI think you meant to spell that \"rewrite_refs=\" instead of \"rebase_refs=\".\n\n>  \n> @@ -246,6 +250,19 @@ do\n>  \t\tstrategy=\"$1\"\n>  \t\tdo_merge=t\n>  \t\t;;\n> +\t--rewrite-refs)\n> +\t\tshift\n> +\t\trewrite_refs=\"$rewrite_refs $1\"\n> +\t\ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n> +\t\t;;\n> +\t--rewrite-heads)\n> +\t\trewrite_refs=\"$rewrite_refs refs/heads\"\n> +\t\ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n> +\t\t;;\n> +\t--rewrite-tags)\n> +\t\trewrite_refs=\"$rewrite_refs refs/tags\"\n> +\t\ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n> +\t\t;;\n>  \t-n)\n>  \t\tdiffstat=\n>  \t\t;;\n\nThen it matches the rest of the commit.\n\nPhil\n"},{"id":"170583","messageId":"7vhb7bxgt9.fsf@alter.siamese.dyndns.org","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"Re: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-27T18:36:18Z","receivedAt":"2011-06-27T18:36:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Greg Price <greg@quora.com> writes:\n\n> With this series, the command\n>   $ git rebase --rewrite-heads master topic\n> suffices to produce this result:\n>\n>         part1 part2 topic\n>   A       |     |     |\n>    \\      v     v     v\n>     B--*--*--*--*--*--*\n>     ^\n>     |\n>     master\n\nThanks for a re-roll.\n\nI notice that this does not address the \"side branch\" issue raised during\nthe original discussion. I do agree with Michael\n\n  http://thread.gmane.org/gmane.comp.version-control.git/135601/focus=135617\n\nthat having some commits on these part$N side branches is far more common\nuse case that would benefit from a \"rewrite together\" feature like this,\nthan moving part$N side branches that just mark points in the topic\nwithout doing anything on their own and makes me doubt if doing only the\nparts that can sanely done within the limitation of the current rebase-i\nimplementation like this series does adds much value to the system [*1*].\n\nIt would be nice to have a clear definition of what _should_ happen in\nthis case, and a test that makes sure that that is the behaviour we get.\n\nStarting from this topology\n\n          1   2   topic\n  A---X---Y---Z---W\n   \\\n    B\n\nwhere the change going from A to B is an equilvalent to the change going\nfrom Y to Z, a rebase of A..W would reproduce this topology:\n\n\n          1   2   topic\n  A---X---Y---Z---W\n   \\\n    B---X'--Y'--W'\n\t    1'  topic'\n\nWhat should heppen to ref2? Should it be deleted? Should it point at Y'?\n\n\n[Footnote]\n\n*1* I suspect that dealing with side branches would require a much richer\nimplementation of the sequencer machinery that lets you go back to a\nprevious state, which we do not have right now.\n\nWhile I think that it makes your series much less interesting than the\nseries could be that not being able to rewrite side branches, I do not\nthink it is reasonable to expect it be done within the current rebase-i\nimplementation/limitation.\n\nWith a richer sequencer, when you want to rebuild 'topic' along with 'side'\nin this picture:\n\n            D side\n           /\n  A---B---C---E---F topic\n   \\\n    X\n\non top of X, I would imagine that your rebase-i insn sheet would say\nsomething like this:\n\n    detach at X\n    replay B\n    replay C\n    replay E\n    replay F\n    update ref \"topic\" with HEAD\n    detach at the rewritten C\n    replay D\n    update ref \"side\" with HEAD\n"},{"id":"170585","messageId":"7vd3hzxgbn.fsf@alter.siamese.dyndns.org","threadId":"27706","inReplyTo":"186680ca6febeb231e9a4fb44cee1e6aff58db6c.1309133817.git.greg@quora.com","subject":"Re: [PATCH 1/6] rebase -i: Add the \"ref\" command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-27T18:46:52Z","receivedAt":"2011-06-27T18:46:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Greg Price <price@MIT.EDU> writes:\n\n> ...\n> +\t\tif ! grep -Fq \" $refname\" \"$state_dir\"/oldrefs 2>/dev/null\n> +\t\tthen\n> +\t\t\techo \"$sha1 $refname\" >> \"$state_dir\"/oldrefs\n\n(Style) Extra SP between \">>\" and \"$state_dir/oldrefs\"\n\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index d7855ea..1bfe6a8 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -118,6 +118,8 @@ read_basic_state () {\n>  \t\tstrategy_opts=\"$(cat \"$state_dir\"/strategy_opts)\"\n>  \ttest -f \"$state_dir\"/allow_rerere_autoupdate &&\n>  \t\tallow_rerere_autoupdate=\"$(cat \"$state_dir\"/allow_rerere_autoupdate)\"\n> +\ttest -f \"$state_dir\"/oldrefs &&\n> +\t\toldrefs=\"$(cat \"$state_dir\"/oldrefs)\"\n>  }\n>  \n>  write_basic_state () {\n> @@ -332,6 +334,15 @@ skip)\n>  abort)\n>  \tgit rerere clear\n>  \tread_basic_state\n> +\t[ -n \"$oldrefs\" ] && echo \"$oldrefs\" | while read sha1 ref\n\n(Style) I think almost everybody else spells out \"test\".  Also please\nbreak line before the while, like this:\n\n\ttest -n \"$oldrefs\" &&\n\techo \"$oldrefs\" |\n\twhile read sha1 ref\n        do\n        \t...\n\n> +\tdo\n> +\t\tif test \"(null)\" = $sha1\n\nWho is giving you \"(null)\"???\n"},{"id":"170590","messageId":"7voc1jw0ss.fsf@alter.siamese.dyndns.org","threadId":"27706","inReplyTo":"9d9e18b8c062380025f52a6ff992fae51a17f5d1.1309133817.git.greg@quora.com","subject":"Re: [PATCH 2/6] pretty: Add %D for script-friendly decoration","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-27T19:07:31Z","receivedAt":"2011-06-27T19:07:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Greg Price <price@MIT.EDU> writes:\n\n> +static void format_decoration_short(struct strbuf *sb, const struct commit *commit)\n> +{\n> +\tconst char *affixes[3] = {\" (\", \", \", \")\"};\n> +\tformat_decoration(sb, commit, DECORATE_SHORT_REFS, affixes);\n> +}\n> +\n> +static void format_decoration_full(struct strbuf *sb, const struct commit *commit)\n> +{\n> +\tconst char *affixes[3] = {\"\", \" \", \"\"};\n> +\tformat_decoration(sb, commit, DECORATE_FULL_REFS, affixes);\n>  }\n\nNice and cute abstraction. I like this part of the series.\n"},{"id":"170593","messageId":"7vy60nugwj.fsf@alter.siamese.dyndns.org","threadId":"27706","inReplyTo":"ab6d17ba0ea919e0f873597b60d6c7e9a43460c8.1309133817.git.greg@quora.com","subject":"Re: [PATCH 6/6] rebase --rewrite-refs: tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-27T21:02:36Z","receivedAt":"2011-06-27T21:02:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Greg Price <price@MIT.EDU> writes:\n\n> diff --git a/t/t3420-rebase-ref.sh b/t/t3420-rebase-ref.sh\n> new file mode 100644\n\nForgot the executable bit?\n"},{"id":"170595","messageId":"7vtybbufy2.fsf@alter.siamese.dyndns.org","threadId":"27706","inReplyTo":"cover.1309133817.git.greg@quora.com","subject":"Re: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-27T21:23:17Z","receivedAt":"2011-06-27T21:23:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Have you ran all tests with the changes in this series, especially the\nones in t34xx series?\n"},{"id":"170614","messageId":"20110628104758.GS5771@dr-wily.mit.edu","threadId":"27706","inReplyTo":"7vhb7bxgt9.fsf@alter.siamese.dyndns.org","subject":"Re: Fwd: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-06-28T10:47:58Z","receivedAt":"2011-06-28T10:47:58Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"On Mon, Jun 27, 2011 at 11:36 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Thanks for a re-roll.\n> \n> I notice that this does not address the \"side branch\" issue raised during\n> the original discussion. I do agree with Michael\n> \n>  http://thread.gmane.org/gmane.comp.version-control.git/135601/focus=135617\n> \n> that having some commits on these part$N side branches is far more common\n> use case that would benefit from a \"rewrite together\" feature like this,\n> than moving part$N side branches that just mark points in the topic\n> without doing anything on their own and makes me doubt if doing only the\n> parts that can sanely done within the limitation of the current rebase-i\n> implementation like this series does adds much value to the system [*1*].\n\nI would also like to support that use case.  In my personal\nexperience, the case where the part$N are ancestors of the topic has\nactually been the more common case; typically it's that part1 is some\ntopic, and then part2 is a further topic that depends on the changes\nin part1, so naturally it goes directly on top of it.  So I'd be\npleased to get the functionality of the present series in, even before\nsupporting the more general case.\n\nI agree with your footnote -- the more general case will require a\nmore powerful sequencer to support properly.  And now I see that\nRamkumar Ramachandra is making progress on such a thing right now!\nThat's great news -- this is a project that has been attempted at\nleast four times, by five people (including me), in the last three\nyears.  I hope to see this round make it in -- I was actually thinking\nabout returning to the problem after seeing this series through, but I\nwould be glad to see Ram beat me to it.\n\nWhen the more powerful sequencer comes along, it may be necessary to\nrewrite some of this code in C (IIUC how the new sequencer will work),\nbut that shouldn't be hard, and is probably easier starting from a\nshell version than from scratch.  Other than that, this code should go\nin smoothly as the main ingredient, other than the sequencer itself,\nneeded for the general \"rewrite side branches\" feature.  With that and\nbecause this series is independently useful, my suggestion would be to\nmerge it when it's ready in itself, without waiting for the sequencer.\n\n\n\n> It would be nice to have a clear definition of what _should_ happen in\n> this case, and a test that makes sure that that is the behaviour we get.\n> \n> Starting from this topology\n> \n>          1   2   topic\n>  A---X---Y---Z---W\n>   \\\n>    B\n> \n> where the change going from A to B is an equilvalent to the change going\n> from Y to Z, a rebase of A..W would reproduce this topology:\n> \n> \n>          1   2   topic\n>  A---X---Y---Z---W\n>   \\\n>    B---X'--Y'--W'\n>            1'  topic'\n> \n> What should heppen to ref2? Should it be deleted? Should it point at Y'?\n\nI would have it point at Y'.  That's what would happen if we just said\n\"git rebase B ref2\" (or threw in --rewrite-heads to pull along ref1),\nand I think it makes the most sense to be consistent.\n\nThis consistency also means we can think of the reset that rebase\nperforms when it finishes as equivalent to an implicit\n\"ref refs/heads/topic\" command at the end of the TODO file, which I\nwouldn't point out in explaining to a beginner but I think is a nice\nproperty for \"ref\" to have.\n\nI'll add a test for this scenario.\n\nGreg\n"},{"id":"170615","messageId":"20110628105631.GT5771@dr-wily.mit.edu","threadId":"27706","inReplyTo":"7vtybbufy2.fsf@alter.siamese.dyndns.org","subject":"Re: Fwd: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-06-28T10:56:32Z","receivedAt":"2011-06-28T10:56:32Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"On Mon, Jun 27, 2011 at 2:23 PM, Junio C Hamano <gitster@pobox.com>\nwrote:\n> Have you ran all tests with the changes in this series, especially the\n> ones in t34xx series?\n\nErr, now that would be smart, now wouldn't it. =)\n\nIn fact, I had a stupid bug that this caught.  Fixed, will include in\nnext reroll (much sooner than this reroll was =P).  All tests now pass.\n\nGreg\n\n\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 42ea3e7..3b1e375 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -741,7 +741,7 @@ else\n        revisions=$onto...$orig_head\n        shortrevisions=$shorthead\n fi\n-if test -z \"rewrite_refs\"\n+if test -z \"$rewrite_refs\"\n then\n        pretty=oneline\n else\n"},{"id":"170616","messageId":"20110628111553.GU5771@dr-wily.mit.edu","threadId":"27706","inReplyTo":"7vd3hzxgbn.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/6] rebase -i: Add the \"ref\" command","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-06-28T11:15:53Z","receivedAt":"2011-06-28T11:15:53Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"Thanks for the review.\n\nOn Mon, Jun 27, 2011 at 11:46:52AM -0700, Junio C Hamano wrote:\n> Greg Price <price@MIT.EDU> writes:\n> \n> > ...\n> > +\t\tif ! grep -Fq \" $refname\" \"$state_dir\"/oldrefs 2>/dev/null\n> > +\t\tthen\n> > +\t\t\techo \"$sha1 $refname\" >> \"$state_dir\"/oldrefs\n> \n> (Style) Extra SP between \">>\" and \"$state_dir/oldrefs\"\n\nHmm -- it looks like the prevalent style in the codebase is actually\nto include the space:\n\ngreg@gouda:~/w/git$ git grep -c '>>[^ ]' v1.7.6 git-*.sh\nv1.7.6:git-bisect.sh:3\nv1.7.6:git-instaweb.sh:2\nv1.7.6:git-rebase--interactive.sh:2\nv1.7.6:git-stash.sh:1\ngreg@gouda:~/w/git$ git grep -c '>> ' v1.7.6 git-*.sh\nv1.7.6:git-am.sh:1\nv1.7.6:git-filter-branch.sh:1\nv1.7.6:git-instaweb.sh:8\nv1.7.6:git-rebase--interactive.sh:10\nv1.7.6:git-rebase--merge.sh:1\n\nand in particular in git-rebase--interactive.sh.  But I could do it\neither way.\n\n\n\n> > @@ -332,6 +334,15 @@ skip)\n> >  abort)\n> >  \tgit rerere clear\n> >  \tread_basic_state\n> > +\t[ -n \"$oldrefs\" ] && echo \"$oldrefs\" | while read sha1 ref\n> \n> (Style) I think almost everybody else spells out \"test\".  Also please\n> break line before the while, like this:\n> \n> \ttest -n \"$oldrefs\" &&\n> \techo \"$oldrefs\" |\n> \twhile read sha1 ref\n>         do\n>         \t...\n\nSure, done.\n\n\n\n> > +\tdo\n> > +\t\tif test \"(null)\" = $sha1\n> \n> Who is giving you \"(null)\"???\n\nI am, myself -- it's what the 'ref' implementation in\ngit-rebase--interactive.sh uses to indicate that a ref had not existed\nand should be deleted on abort.\n\n+       ref)\n+               mark_action_done\n+               refname=$sha1\n+               sha1=$(git rev-parse --quiet --verify \"$refname\" \\\n+                       || echo \"(null)\")\n+               if ! grep -Fq \" $refname\" \"$state_dir\"/oldrefs 2>/dev/null\n+               then\n+                       echo \"$sha1 $refname\" >> \"$state_dir\"/oldrefs\n+               fi\n\nI could change it to something like \"-\".  It needs to be something\nthat the 'read' builtin, as used at the top of the loop, treats as a\nword.\n\nGreg\n"},{"id":"170617","messageId":"20110628111907.GV5771@dr-wily.mit.edu","threadId":"27706","inReplyTo":"4E08ABBB.9060009@cisco.com","subject":"Re: [PATCH 4/6] rebase: --rewrite-{refs,heads,tags} to pull refs along with branch","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-06-28T11:19:07Z","receivedAt":"2011-06-28T11:19:07Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"On Mon, Jun 27, 2011 at 12:11:39PM -0400, Phil Hord wrote:\n> On 11/18/2009 06:51 PM, Greg Price wrote:\n> > @@ -96,6 +99,7 @@ state_dir=\n> >  # One of {'', continue, skip, abort}, as parsed from command line\n> >  action=\n> >  preserve_merges=\n> > +rebase_refs=\n> >  autosquash=\n> >  test \"$(git config --bool rebase.autosquash)\" = \"true\" && autosquash=t\n> I think you meant to spell that \"rewrite_refs=\" instead of \"rebase_refs=\".\n\nHa, so I did.  Fixed.  Thanks!\n\nGreg\n"},{"id":"170618","messageId":"20110628112012.GW5771@dr-wily.mit.edu","threadId":"27706","inReplyTo":"7vy60nugwj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 6/6] rebase --rewrite-refs: tests","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-06-28T11:20:12Z","receivedAt":"2011-06-28T11:20:12Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"On Mon, Jun 27, 2011 at 02:02:36PM -0700, Junio C Hamano wrote:\n> Greg Price <price@MIT.EDU> writes:\n> \n> > diff --git a/t/t3420-rebase-ref.sh b/t/t3420-rebase-ref.sh\n> > new file mode 100644\n> \n> Forgot the executable bit?\n\nYup, thanks, fixed.\n\nGreg\n"},{"id":"170619","messageId":"20110628112200.GX5771@dr-wily.mit.edu","threadId":"27706","inReplyTo":"4E08AAAE.5020604@cisco.com","subject":"Re: [PATCH 6/6] rebase --rewrite-refs: tests","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-06-28T11:22:01Z","receivedAt":"2011-06-28T11:22:01Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"On Mon, Jun 27, 2011 at 12:07:10PM -0400, Phil Hord wrote:\n> On 01/24/2010 09:28 PM, Greg Price wrote:\n> > +test_expect_success setup '\n> > +\ttest_commit A &&\n> > +\tgit branch topic &&\n> > +\ttest_commit B &&\n> > +\tgit checkout topic &&\n> > +\ttest_commit C &&\n> > +\tgit branch part1 &&\n> > +\ttest_commit D\n> > +\tgit branch part2 &&\n> > +\ttest_commit E\n> > +'\n> \n> I think there is a missing \"&&\" at the end of \"test_commit D\".  But it's\n> possible I just don't understand the test machinery enough to know this\n> is normal.  Can you explain to me the difference in that case?\n\nNope, that's just a mistake -- it means that if \"test_commit D\" were\nto somehow fail, we'd move on as if nothing was wrong.  Fixed, thanks.\n\nGreg\n"},{"id":"170623","messageId":"20110628131717.GA6822@dr-wily.mit.edu","threadId":"27706","inReplyTo":"20110628104758.GS5771@dr-wily.mit.edu","subject":"Re: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-06-28T13:17:17Z","receivedAt":"2011-06-28T13:17:17Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"On Tue, Jun 28, 2011 at 06:47:58AM -0400, Greg Price wrote:\n> I agree with your footnote -- the more general case will require a\n> more powerful sequencer to support properly.  And now I see that\n> Ramkumar Ramachandra is making progress on such a thing right now!\n> That's great news -- this is a project that has been attempted at\n> least four times, by five people (including me), in the last three\n> years.  I hope to see this round make it in -- I was actually thinking\n> about returning to the problem after seeing this series through, but I\n> would be glad to see Ram beat me to it.\n\n[Hello, Ram!]\n\nHmm, on further reading I'm not sure the sequencer Ram aims to build\nthis summer actually extends to the \"mark\" and \"reset\" commands (or\nthe concepts of \"the rewritten <commit>\" and \"detach\" in the\npseudo-TODO notation of your footnote) that would be required to\nimplement this broader rewrite-side-branches feature.  It looks like\nthe focus may be on taking the existing features of rebase and\nbringing them into C.\n\nThis sounds great too -- it should make rebase a lot faster -- but it\nwill leave open the pet project I've thought about returning to, of\nmaking \"rebase -i -p\" work correctly even when the user wants to\nrearrange the commits rather than just s/pick/edit/ etc.  That will\nrequire implementing a richer sequencer very like the one required for\na general rewrite-side-branches feature.\n\nRam, have I correctly read your plans?  For context, see Junio's\nremarks upthread about one thing a richer sequencer could be used for:\n  http://thread.gmane.org/gmane.comp.version-control.git/176339/focus=176359\n\nGreg\n"},{"id":"170690","messageId":"BANLkTimZzMXo17eRQMSq8RBQ9FBM4ui25Q@mail.gmail.com","threadId":"27706","inReplyTo":"20110628131717.GA6822@dr-wily.mit.edu","subject":"Re: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2011-06-30T04:25:11Z","receivedAt":"2011-06-30T04:25:11Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Greg!\n\nGreg Price writes:\n> On Tue, Jun 28, 2011 at 06:47:58AM -0400, Greg Price wrote:\n>> I agree with your footnote -- the more general case will require a\n>> more powerful sequencer to support properly.  And now I see that\n>> Ramkumar Ramachandra is making progress on such a thing right now!\n>> That's great news -- this is a project that has been attempted at\n>> least four times, by five people (including me), in the last three\n>> years.  I hope to see this round make it in -- I was actually thinking\n>> about returning to the problem after seeing this series through, but I\n>> would be glad to see Ram beat me to it.\n\nYou're more than welcome to join in -- all the work is public :)\nThe latest iteration of the sequencer is in 'pu', and I'm currently\nbusy rolling out a nicer version.\n\n> Hmm, on further reading I'm not sure the sequencer Ram aims to build\n> this summer actually extends to the \"mark\" and \"reset\" commands (or\n> the concepts of \"the rewritten <commit>\" and \"detach\" in the\n> pseudo-TODO notation of your footnote) that would be required to\n> implement this broader rewrite-side-branches feature.  It looks like\n> the focus may be on taking the existing features of rebase and\n> bringing them into C.\n\nYes, you're absolutely right.  Bringing the existing features to C is\nquite a challenging task in itself, and is bound to keep me busy for\nthe rest of the summer.  I don't plan to implement the features your\nseries introduces yet, but it's certainly a great long-term goal -- I\nthink the current series has all the right ingredients;  it just\nrequires a lot of work before it can start providing more features.\n\n> This sounds great too -- it should make rebase a lot faster -- but it\n> will leave open the pet project I've thought about returning to, of\n> making \"rebase -i -p\" work correctly even when the user wants to\n> rearrange the commits rather than just s/pick/edit/ etc.  That will\n> require implementing a richer sequencer very like the one required for\n> a general rewrite-side-branches feature.\n\nRight.  Since all this will take time, it'll probably be a good idea\nto get your series merged in now.\n\n-- Ram\n"},{"id":"172758","messageId":"CAGdFq_jLv810a1H=+M14hEho9B_BS4OhdVUz1S-jjMBi6PP28g@mail.gmail.com","threadId":"27706","inReplyTo":"20110628104758.GS5771@dr-wily.mit.edu","subject":"Re: Fwd: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-08-03T13:32:41Z","receivedAt":"2011-08-03T13:32:41Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Jun 28, 2011 at 12:47, Greg Price <price@mit.edu> wrote:\n> I would also like to support that use case.  In my personal\n> experience, the case where the part$N are ancestors of the topic has\n> actually been the more common case; typically it's that part1 is some\n> topic, and then part2 is a further topic that depends on the changes\n> in part1, so naturally it goes directly on top of it.  So I'd be\n> pleased to get the functionality of the present series in, even before\n> supporting the more general case.\n\nFWIW, I'm having the exact same need while working on the remote-hg\nseries (which depends on my remote-helper follow-up series, which\ndepends on fast-export-fixes, which depends on my original\nremote-helper series, which depends on peffs initial patches; luckily\nthe latter two have been merged to next :P). I'd really like having\nthis available, especially the rebase -i support.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"172825","messageId":"20110803223110.GJ16707@dr-wily.mit.edu","threadId":"27706","inReplyTo":"CAGdFq_jLv810a1H=+M14hEho9B_BS4OhdVUz1S-jjMBi6PP28g@mail.gmail.com","subject":"Re: Fwd: [PATCH 0/6] rebase: command \"ref\" and options --rewrite-{refs,heads,tags}","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2011-08-03T22:31:11Z","receivedAt":"2011-08-03T22:31:11Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"On Wed, Aug 03, 2011 at 03:32:41PM +0200, Sverre Rabbelier wrote:\n> FWIW, I'm having the exact same need while working on the remote-hg\n> series (which depends on my remote-helper follow-up series, which\n> depends on fast-export-fixes, which depends on my original\n> remote-helper series, which depends on peffs initial patches; luckily\n> the latter two have been merged to next :P). I'd really like having\n> this available, especially the rebase -i support.\n\nThanks for the encouragement and the poke.  Work is busy, but I've put\ntogether a new version of the series addressing everyone's comments\nfrom last time.  I'll give it the finishing touches and try to send it\nout soon.\n\nGreg\n"}]}