From 586801650824f0f7b62c34a206b6a60ffbcd8be0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@redhat.com>
Date: Mon, 17 Sep 2007 20:06:44 -0400
Subject: Introduce entry point add_interactive and add_files_to_cache
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This refactors builtin-add.c a little to provide a unique entry point
for launching git add --interactive, which will be used by
builtin-commit too.  If we later want to make add --interactive a
builtin or change how it is launched, we just start from this function.

It also exports the private function update() which is used to
add all modified paths to the index as add_files_to_cache().

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.h | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index b779de8cbc..b50c30e255 100644
--- a/commit.h
+++ b/commit.h
@@ -128,4 +128,8 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads,
 		int depth, int shallow_flag, int not_shallow_flag);
 
 int in_merge_bases(struct commit *, struct commit **, int);
+
+extern int interactive_add(void);
+extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
+
 #endif /* COMMIT_H */
-- 
cgit v1.2.1


From d8b7db0abfd0c74478964f5a9b08ad141f4f7f82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@redhat.com>
Date: Mon, 17 Sep 2007 20:06:47 -0400
Subject: Export rerere() and launch_editor().
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.h | 1 +
 1 file changed, 1 insertion(+)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index b50c30e255..b661503972 100644
--- a/commit.h
+++ b/commit.h
@@ -131,5 +131,6 @@ int in_merge_bases(struct commit *, struct commit **, int);
 
 extern int interactive_add(void);
 extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
+extern int rerere(void);
 
 #endif /* COMMIT_H */
-- 
cgit v1.2.1


From 4593fb84051d39f65cec81958e91056986e4682f Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Wed, 31 Oct 2007 14:55:17 -0700
Subject: format-patch -s: add MIME encoding header if signer's name requires
 so

When the body of the commit log message contains a non-ASCII character,
format-patch correctly emitted the encoding header to mark the resulting
message as such.  However, if the original message was fully ASCII, the
command line switch "-s" was given to add a new sign-off, and
the signer's name was not ASCII only, the resulting message would have
contained non-ASCII character but was not marked as such.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index b661503972..13b537293d 100644
--- a/commit.h
+++ b/commit.h
@@ -61,13 +61,15 @@ enum cmit_fmt {
 	CMIT_FMT_UNSPECIFIED,
 };
 
+extern int non_ascii(int);
 extern enum cmit_fmt get_commit_format(const char *arg);
 extern void format_commit_message(const struct commit *commit,
                                   const void *format, struct strbuf *sb);
 extern void pretty_print_commit(enum cmit_fmt fmt, const struct commit*,
                                 struct strbuf *,
                                 int abbrev, const char *subject,
-                                const char *after_subject, enum date_mode);
+                                const char *after_subject, enum date_mode,
+				int non_ascii_present);
 
 /** Removes the first commit from a list sorted by date, and adds all
  * of its parents.
-- 
cgit v1.2.1


From 23c17d4a4a0e1fc9a5fa347f1fc6be3cf477e543 Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 2 Nov 2007 13:32:58 -0700
Subject: Simplify topo-sort logic

.. by not using quite so much indirection.

This currently grows the "struct commit" a bit, which could be avoided by
using a union for "util" and "indegree" (the topo-sort used to use "util"
anyway, so you cannot use them together), but for now the goal of this was
to simplify, not optimize.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 commit.h | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index 13b537293d..4ed0c1cf7f 100644
--- a/commit.h
+++ b/commit.h
@@ -14,6 +14,7 @@ struct commit_list {
 struct commit {
 	struct object object;
 	void *util;
+	unsigned int indegree;
 	unsigned long date;
 	struct commit_list *parents;
 	struct tree *tree;
@@ -84,31 +85,12 @@ void clear_commit_marks(struct commit *commit, unsigned int mark);
 /*
  * Performs an in-place topological sort of list supplied.
  *
- * Pre-conditions for sort_in_topological_order:
- *   all commits in input list and all parents of those
- *   commits must have object.util == NULL
- *
- * Pre-conditions for sort_in_topological_order_fn:
- *   all commits in input list and all parents of those
- *   commits must have getter(commit) == NULL
- *
- * Post-conditions:
  *   invariant of resulting list is:
  *      a reachable from b => ord(b) < ord(a)
  *   in addition, when lifo == 0, commits on parallel tracks are
  *   sorted in the dates order.
  */
-
-typedef void (*topo_sort_set_fn_t)(struct commit*, void *data);
-typedef void* (*topo_sort_get_fn_t)(struct commit*);
-
-void topo_sort_default_setter(struct commit *c, void *data);
-void *topo_sort_default_getter(struct commit *c);
-
 void sort_in_topological_order(struct commit_list ** list, int lifo);
-void sort_in_topological_order_fn(struct commit_list ** list, int lifo,
-				  topo_sort_set_fn_t setter,
-				  topo_sort_get_fn_t getter);
 
 struct commit_graft {
 	unsigned char sha1[20];
-- 
cgit v1.2.1


From 53b2c823f6e862e0c83a4a25bab43e8c32e9c289 Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 5 Nov 2007 13:22:34 -0800
Subject: revision walker: mini clean-up

This removes the unnecessary indirection of "revs->prune_fn",
since that function is always the same one (or NULL), and there
is in fact not even an abstraction reason to make it a function
(i.e. its not called from some other file and doesn't allow us
to keep the function itself static or anything like that).

It then just replaces it with a bit that says "prune or not",
and if not pruning, every commit gets TREECHANGE.

That in turn means that

 - if (!revs->prune_fn || (flags & TREECHANGE))
 - if (revs->prune_fn && !(flags & TREECHANGE))

just become

 - if (flags & TREECHANGE)
 - if (!(flags & TREECHANGE))

respectively.

Together with adding the "single_parent()" helper function, the "complex"
conditional now becomes

	if (!(flags & TREECHANGE) && rev->dense && single_parent(commit))
		continue;

Also indirection of "revs->dense" checking is thrown away the
same way, because TREECHANGE bit is set appropriately now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.h | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index 4ed0c1cf7f..aa679867a9 100644
--- a/commit.h
+++ b/commit.h
@@ -117,4 +117,9 @@ extern int interactive_add(void);
 extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
 extern int rerere(void);
 
+static inline int single_parent(struct commit *commit)
+{
+	return commit->parents && !commit->parents->next;
+}
+
 #endif /* COMMIT_H */
-- 
cgit v1.2.1


From 7c0ab4458994aa895855abc4a504cf693ecc0cf1 Mon Sep 17 00:00:00 2001
From: Wincent Colaiuta <win@wincent.com>
Date: Thu, 22 Nov 2007 01:02:52 +0100
Subject: Teach builtin-add to pass multiple paths to git-add--interactive

Instead of just accepting a single file parameter, git-add now accepts
any number of path parameters, fowarding them to git-add--interactive.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index aa679867a9..d82b8bc300 100644
--- a/commit.h
+++ b/commit.h
@@ -113,7 +113,7 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads,
 
 int in_merge_bases(struct commit *, struct commit **, int);
 
-extern int interactive_add(void);
+extern int interactive_add(int argc, const char **argv);
 extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
 extern int rerere(void);
 
-- 
cgit v1.2.1


From b6ec1d619fb54642388063a88e2255556cf5de06 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Sun, 18 Nov 2007 01:12:04 -0800
Subject: Fix add_files_to_cache() to take pathspec, not user specified list of
 files

This separates the logic to limit the extent of change to the
index by where you are (controlled by "prefix") and what you
specify from the command line (controlled by "pathspec").

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.h | 1 -
 1 file changed, 1 deletion(-)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index aa679867a9..f450aae8aa 100644
--- a/commit.h
+++ b/commit.h
@@ -114,7 +114,6 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads,
 int in_merge_bases(struct commit *, struct commit **, int);
 
 extern int interactive_add(void);
-extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
 extern int rerere(void);
 
 static inline int single_parent(struct commit *commit)
-- 
cgit v1.2.1


From 3f061887c562b20d3ed3d1f764462cf986a1ad12 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Sun, 25 Nov 2007 10:10:10 -0800
Subject: add -i: Fix running from a subdirectory

This fixes the pathspec interactive_add() passes to the underlying
git-add--interactive helper.  When the command was run from a
subdirectory, cmd_add() already has gone up to the toplevel of the work
tree, and the helper will be spawned from there.  The pathspec given on
the command line from the user needs to be adjusted for this.

This adds "validate_pathspec()" function in the callchain, but it does
not validate yet.  The function can be changed to barf if there are
unmatching pathspec given by the user, but that is not strictly
necessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 commit.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'commit.h')

diff --git a/commit.h b/commit.h
index 9f0765bd9c..10e2b5d4cf 100644
--- a/commit.h
+++ b/commit.h
@@ -113,7 +113,7 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads,
 
 int in_merge_bases(struct commit *, struct commit **, int);
 
-extern int interactive_add(int argc, const char **argv);
+extern int interactive_add(int argc, const char **argv, const char *prefix);
 extern int rerere(void);
 
 static inline int single_parent(struct commit *commit)
-- 
cgit v1.2.1