[PATCH v5 00/10] The final building block for a faster rebase -i

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch series reimplements the expensive pre- and post-processing of
the todo script in C.

And it concludes the work I did to accelerate rebase -i so far.

I am still unwilling to replace a compile-time safe way to pass the
options to the revision machinery by the alternative (which I am still
flabbergasted about) proposed by Junio. This will not change.

Changes since v4:

- replaced the "sha1s" part of the names by "ids", to reflect the
  current effort to move away from the cryptographically unsafe SHA-1

- replaced the confusing term "instruction sheet" in an error message by
  the more commonly used "todo list"


Johannes Schindelin (10):
  t3415: verify that an empty instructionFormat is handled as before
  rebase -i: generate the script via rebase--helper
  rebase -i: remove useless indentation
  rebase -i: do not invent onelines when expanding/collapsing SHA-1s
  rebase -i: also expand/collapse the SHA-1s via the rebase--helper
  t3404: relax rebase.missingCommitsCheck tests
  rebase -i: check for missing commits in the rebase--helper
  rebase -i: skip unnecessary picks using the rebase--helper
  t3415: test fixup with wrapped oneline
  rebase -i: rearrange fixup/squash lines using the rebase--helper

 Documentation/git-rebase.txt  |  16 +-
 builtin/rebase--helper.c      |  29 ++-
 git-rebase--interactive.sh    | 373 ++++-------------------------
 sequencer.c                   | 530 ++++++++++++++++++++++++++++++++++++++++++
 sequencer.h                   |   8 +
 t/t3404-rebase-interactive.sh |  22 +-
 t/t3415-rebase-autosquash.sh  |  28 ++-
 7 files changed, 646 insertions(+), 360 deletions(-)


base-commit: 02a2850ad58eff6de70eb2dc5f96345c463857ac
Based-On: rebase--helper at https://github.com/dscho/git
Fetch-Base-Via: git fetch https://github.com/dscho/git rebase--helper
Published-As: https://github.com/dscho/git/releases/tag/rebase-i-extra-v5
Fetch-It-Via: git fetch https://github.com/dscho/git rebase-i-extra-v5

Interdiff vs v4:
 diff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c
 index e6591f01112..64b36d429fa 100644
 --- a/builtin/rebase--helper.c
 +++ b/builtin/rebase--helper.c
 @@ -25,9 +25,9 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
  				ABORT),
  		OPT_CMDMODE(0, "make-script", &command,
  			N_("make rebase script"), MAKE_SCRIPT),
 -		OPT_CMDMODE(0, "shorten-sha1s", &command,
 +		OPT_CMDMODE(0, "shorten-ids", &command,
  			N_("shorten SHA-1s in the todo list"), SHORTEN_SHA1S),
 -		OPT_CMDMODE(0, "expand-sha1s", &command,
 +		OPT_CMDMODE(0, "expand-ids", &command,
  			N_("expand SHA-1s in the todo list"), EXPAND_SHA1S),
  		OPT_CMDMODE(0, "check-todo-list", &command,
  			N_("check the todo list"), CHECK_TODO_LIST),
 diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
 index 71d190766cf..3b0340e7cc9 100644
 --- a/git-rebase--interactive.sh
 +++ b/git-rebase--interactive.sh
 @@ -714,11 +714,11 @@ do_rest () {
  }
  
  expand_todo_ids() {
 -	git rebase--helper --expand-sha1s
 +	git rebase--helper --expand-ids
  }
  
  collapse_todo_ids() {
 -	git rebase--helper --shorten-sha1s
 +	git rebase--helper --shorten-ids
  }
  
  # Add commands after a pick or after a squash/fixup serie
 diff --git a/sequencer.c b/sequencer.c
 index 6373f20a019..06c97e12267 100644
 --- a/sequencer.c
 +++ b/sequencer.c
 @@ -2464,7 +2464,7 @@ int sequencer_make_script(int keep_empty, FILE *out,
  }
  
  
 -int transform_todo_ids(int shorten_sha1s)
 +int transform_todo_ids(int shorten_ids)
  {
  	const char *todo_file = rebase_path_todo();
  	struct todo_list todo_list = TODO_LIST_INIT;
 @@ -2484,7 +2484,7 @@ int transform_todo_ids(int shorten_sha1s)
  	res = parse_insn_buffer(todo_list.buf.buf, &todo_list);
  	if (res) {
  		todo_list_release(&todo_list);
 -		return error(_("unusable instruction sheet: '%s'"), todo_file);
 +		return error(_("unusable todo list: '%s'"), todo_file);
  	}
  
  	out = fopen(todo_file, "w");
 @@ -2503,7 +2503,7 @@ int transform_todo_ids(int shorten_sha1s)
  		if (item->command >= TODO_EXEC && item->command != TODO_DROP)
  			fwrite(p, eol - bol, 1, out);
  		else {
 -			const char *sha1 = shorten_sha1s ?
 +			const char *id = shorten_ids ?
  				short_commit_name(item->commit) :
  				oid_to_hex(&item->commit->object.oid);
  			int len;
 @@ -2512,7 +2512,7 @@ int transform_todo_ids(int shorten_sha1s)
  			len = strcspn(p, " \t"); /* length of command */
  
  			fprintf(out, "%.*s %s %.*s\n",
 -				len, p, sha1, item->arg_len, item->arg);
 +				len, p, id, item->arg_len, item->arg);
  		}
  	}
  	fclose(out);
 @@ -2762,9 +2762,9 @@ static int subject2item_cmp(const struct subject2item_entry *a,
  }
  
  /*
 - * Rearrange the todo list that has both "pick sha1 msg" and "pick sha1
 - * fixup!/squash! msg" in it so that the latter is put immediately after the
 - * former, and change "pick" to "fixup"/"squash".
 + * Rearrange the todo list that has both "pick commit-id msg" and "pick
 + * commit-id fixup!/squash! msg" in it so that the latter is put immediately
 + * after the former, and change "pick" to "fixup"/"squash".
   *
   * Note that if the config has specified a custom instruction format, each log
   * message will have to be retrieved from the commit (as the oneline in the
 diff --git a/sequencer.h b/sequencer.h
 index 1c94bec7622..6f3d3df82c0 100644
 --- a/sequencer.h
 +++ b/sequencer.h
 @@ -48,7 +48,7 @@ int sequencer_remove_state(struct replay_opts *opts);
  int sequencer_make_script(int keep_empty, FILE *out,
  		int argc, const char **argv);
  
 -int transform_todo_ids(int shorten_sha1s);
 +int transform_todo_ids(int shorten_ids);
  int check_todo_list(void);
  int skip_unnecessary_picks(void);
  int rearrange_squash(void);
-- 
2.13.1.windows.1.1.ga36e14b3aaa




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]