git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 4cd487a4500370e7d06cfc77cf15f0984bc94787 2823 bytes (raw)
name: rebase-interactive.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 
#include "cache.h"
#include "commit.h"
#include "rebase-interactive.h"
#include "sequencer.h"
#include "strbuf.h"

void append_todo_help(unsigned edit_todo, unsigned keep_empty,
		      struct strbuf *buf)
{
	const char *msg = _("\nCommands:\n"
"p, pick <commit> = use commit\n"
"r, reword <commit> = use commit, but edit the commit message\n"
"e, edit <commit> = use commit, but stop for amending\n"
"s, squash <commit> = use commit, but meld into previous commit\n"
"f, fixup <commit> = like \"squash\", but discard this commit's log message\n"
"x, exec <command> = run command (the rest of the line) using shell\n"
"b, break = stop here (continue rebase later with 'git rebase --continue')\n"
"d, drop <commit> = remove commit\n"
"l, label <label> = label current HEAD with a name\n"
"t, reset <label> = reset HEAD to a label\n"
"m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]\n"
".       create a merge commit using the original merge commit's\n"
".       message (or the oneline, if no original merge commit was\n"
".       specified). Use -c <commit> to reword the commit message.\n"
"\n"
"These lines can be re-ordered; they are executed from top to bottom.\n");

	strbuf_add_commented_lines(buf, msg, strlen(msg));

	if (get_missing_commit_check_level() == MISSING_COMMIT_CHECK_ERROR)
		msg = _("\nDo not remove any line. Use 'drop' "
			 "explicitly to remove a commit.\n");
	else
		msg = _("\nIf you remove a line here "
			 "THAT COMMIT WILL BE LOST.\n");

	strbuf_add_commented_lines(buf, msg, strlen(msg));

	if (edit_todo)
		msg = _("\nYou are editing the todo file "
			"of an ongoing interactive rebase.\n"
			"To continue rebase after editing, run:\n"
			"    git rebase --continue\n\n");
	else
		msg = _("\nHowever, if you remove everything, "
			"the rebase will be aborted.\n\n");

	strbuf_add_commented_lines(buf, msg, strlen(msg));

	if (!keep_empty) {
		msg = _("Note that empty commits are commented out");
		strbuf_add_commented_lines(buf, msg, strlen(msg));
	}
}

int edit_todo_list(unsigned flags)
{
	struct strbuf buf = STRBUF_INIT;
	const char *todo_file = rebase_path_todo();

	if (strbuf_read_file(&buf, todo_file, 0) < 0)
		return error_errno(_("could not read '%s'."), todo_file);

	strbuf_stripspace(&buf, 1);
	if (write_message(buf.buf, buf.len, todo_file, 0)) {
		strbuf_release(&buf);
		return -1;
	}

	strbuf_release(&buf);

	transform_todo_file(flags | TODO_LIST_SHORTEN_IDS);

	if (strbuf_read_file(&buf, todo_file, 0) < 0)
		return error_errno(_("could not read '%s'."), todo_file);

	append_todo_help(1, 0, &buf);
	if (write_message(buf.buf, buf.len, todo_file, 0)) {
		strbuf_release(&buf);
		return -1;
	}

	strbuf_release(&buf);

	if (launch_sequence_editor(todo_file, NULL, NULL))
		return -1;

	transform_todo_file(flags & ~(TODO_LIST_SHORTEN_IDS));

	return 0;
}

debug log:

solving 4cd487a450 ...
found 4cd487a450 in https://public-inbox.org/git/20181109080805.6350-4-alban.gruin@gmail.com/
found 78f3263fc1 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100644 78f3263fc153079938898989822b57e5888568d6	rebase-interactive.c

applying [1/1] https://public-inbox.org/git/20181109080805.6350-4-alban.gruin@gmail.com/
diff --git a/rebase-interactive.c b/rebase-interactive.c
index 78f3263fc1..4cd487a450 100644

Checking patch rebase-interactive.c...
Applied patch rebase-interactive.c cleanly.

index at:
100644 4cd487a4500370e7d06cfc77cf15f0984bc94787	rebase-interactive.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).