Git development
 help / color / mirror / Atom feed
* Re: Transactions for git (and stgit) ?
From: Karl Hasselström @ 2007-05-12 10:49 UTC (permalink / raw)
  To: Yann Dirson; +Cc: Carl Worth, Linus Torvalds, Johannes Sixt, git
In-Reply-To: <20070512095312.GK19253@nan92-1-81-57-214-146.fbx.proxad.net>

On 2007-05-12 11:53:12 +0200, Yann Dirson wrote:

> It could even be more sensible to implement transactions at the git
> level rather than at the stgit one...

Yes, please. (Unless a convincing technical argument pops up against
it, of course.) Any stgit invariant that isn't based on a git
invariant is one more thing that can break when git and stgit commands
are mixed.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply

* [PATCH] gitweb: Test if $from_id and $to_id are defined before comparison
From: Jakub Narebski @ 2007-05-12 10:42 UTC (permalink / raw)
  To: git
In-Reply-To: <200705120135.30150.jnareb@gmail.com>

Get rid of "Use of uninitialized value in string eq at
gitweb/gitweb.perl line 2320" warning caused by the fact that "empty"
patches, consisting only of extended git diff header and with patch
body empty, such as patch for pure rename, does not have "index" line
in extended diff header.  For such patches $from_id and $to_id, filled
from parsing extended diff header, are undefined.  But such patches
cannot be continuation patches.

Test if $from_id and $to_id are defined before comparing them with
$diffinfo.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This also fixes "Use of uninitialized value ..." error/warning, but this
time it is caused by something else than non-existent object (wrong value
of parameter).

 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index afa0056..2b39502 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2664,9 +2664,10 @@ sub git_patchset_body {
 		# check if current patch belong to current raw line
 		# and parse raw git-diff line if needed
 		if (defined $diffinfo &&
+		    defined $from_id && defined $to_id &&
 		    from_ids_eq($diffinfo->{'from_id'}, $from_id) &&
 		    $diffinfo->{'to_id'} eq $to_id) {
-			# this is split patch
+			# this is continuation of a split patch
 			print "<div class=\"patch cont\">\n";
 		} else {
 			# advance raw git-diff output if needed
-- 
1.5.1.4

^ permalink raw reply related

* Re: [FAQ?] Rationale for git's way to manage the index
From: Jakub Narebski @ 2007-05-12  9:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vlkfu98nn.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > -'git-add' [-n] [-v] [-f] [--interactive | -i] [-u] [--] <file>...
> > +'git-add' [-n] [-v] [-f] (-u [[--] <file>...] | [--] <file>...)
> 
> I do not think this is correct; does -u take optionally path and
> when path is ambiguous you can add -- to disambiguate?
> 
> Honestly, I would rather not sprinkle synopsis with too many
> nested parentheses and brackets, which only makes it harder to
> see without giving a clear "this combines with that but is not
> compatible with the other" information.  Adding comment to the
> section that begins with "-u::" that says "... commit -a; this
> option does not take any paths parameters." would be cleaner,
> and easier to understand.
> 
> Of course, I would prefer a patch to allow use of paths with -u
> even more, but that is what I already said ;-).

This synopisis is for _after_ patch mentioned above. If you don't
like too complicated (too deeply nested) expression in synopsis, it
could always be written as:

-'git-add' [-n] [-v] [-f] [--interactive | -i] [-u] [--] <file>...
+'git-add' [-n] [-v] [-f] [--] <file>...
+'git-add' [-n] [-v] [-f] -u [[--] <file>...]

or something like that
-- 
Jakub Narebski
Poland

^ permalink raw reply

* [PATCH 0/3] Fix assorted white space damage
From: Marco Costalba @ 2007-05-12 11:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Following there is a 3  patch series to remove stealth whitespace.

I have used the new 'cleanfile' script by H. Peter Anvin, just merged
in Linux tree.

The script cleans up various classes of stealth whitespace.  In
particular, it cleans up:

  - Whitespace (spaces or tabs)before newline;
  - DOS line endings (CR before LF);
  - Space before tab (spaces are deleted or converted to tabs);
  - Empty lines at end of file.


Tested with

make
make install
make test


  Marco

^ permalink raw reply

* Re: Using StGIT for tweaking already-committed stuff
From: Karl Hasselström @ 2007-05-12 11:09 UTC (permalink / raw)
  To: Yann Dirson
  Cc: Petr Baudis, Carl Worth, J. Bruce Fields, Linus Torvalds,
	Johannes Sixt, catalin.marinas, git
In-Reply-To: <20070512071023.GD16903@nan92-1-81-57-214-146.fbx.proxad.net>

On 2007-05-12 09:10:23 +0200, Yann Dirson wrote:

> On Sat, May 12, 2007 at 12:43:25AM +0200, Karl Hasselström wrote:
>
> > It shouldn't be necessary with a manual "assimilate" step. If
> > stgit finds that there are unadorned git commits on top of the
> > patch stack, it should do the assimilation automatically. With
> > that in place, "stg new" and "stg refresh" would be nearly
> > superfluous, since git-commit with and without --amend does the
> > same thing -- the only thing they won't do is give the user the
> > option of manually choosing the patch name.
>
> Hm. I'm not that convinced :)
>
> Eg, imagine a merge commit somewhere in the stack. What would stgit
> do with that ?

There are two cases:

  1. The merge commit is below the bottommost patch. This is perfectly
     OK, and nothing special has to be done. The only restriction is
     that we can't uncommit past the merge.

  2. The merge commit is above the topmost patch. (There may or may
     not also be other not-yet-stgitified commits above the topmost
     patch, below or above the merge commit.) In this case, stgit
     should not auto-assimilate the commits on top of the stack (since
     it can't be done for the merge commit), and a number of stgit
     commands (push, pop, new, ...) should refuse to work until the
     user has either reset the branch so that the merge disappears, or
     done "stg commit" on all the patches below the merge.

Note that these are the only cases: stgit should (and does) enforce
the invariant that the applied patches form a consecutive series of
commits, without "holes". This is why "stg new" would be forbidden in
case (2).

The point is not that you should commit merges on top of your patches,
of course. The point is that if you do, stgit should handle it
gracefully. Right now you can commit all your patches and do a merge,
but if you try to do it the other way around, stgit will break down on
you -- but there's no real reason why it should.

> I quite like the idea of makeing it easier to mix them, and removing
> the real duplicates from stgit, but I think that we should be
> careful not to remove power from stgit while doing this.

I agree.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply

* [PATCH 1/3] Fix assorted white space damage in *.c files
From: Marco Costalba @ 2007-05-12 11:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Used the new 'cleanfile' script by H. Peter Anvin, just merged
in Linux tree.

This script cleans up various classes of stealth whitespace.  In
    particular, it cleans up:

    - Whitespace (spaces or tabs)before newline;
    - DOS line endings (CR before LF);
    - Space before tab (spaces are deleted or converted to tabs);
    - Empty lines at end of file.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
 builtin-annotate.c      |    1 -
 builtin-diff-index.c    |    2 +-
 builtin-fmt-merge-msg.c |    1 -
 builtin-fsck.c          |    4 ++--
 builtin-ls-files.c      |    2 +-
 builtin-name-rev.c      |    1 -
 builtin-pack-objects.c  |    4 ++--
 builtin-rerere.c        |    1 -
 builtin-shortlog.c      |    1 -
 builtin-tar-tree.c      |    2 +-
 commit.c                |   14 +++++++-------
 config.c                |    3 +--
 connect.c               |    2 +-
 convert-objects.c       |    2 +-
 copy.c                  |    1 -
 ctype.c                 |    1 -
 daemon.c                |    4 ++--
 date.c                  |   10 +++++-----
 diff-lib.c              |    2 +-
 diff.c                  |    4 ++--
 diffcore-pickaxe.c      |    2 +-
 entry.c                 |    2 +-
 environment.c           |    2 --
 fetch-pack.c            |    2 +-
 fetch.c                 |    4 ++--
 git.c                   |    2 +-
 help.c                  |    2 --
 http-fetch.c            |    2 +-
 http-push.c             |    2 +-
 http.c                  |    2 +-
 imap-send.c             |    2 +-
 local-fetch.c           |    8 ++++----
 lockfile.c              |    1 -
 mailmap.c               |    1 -
 match-trees.c           |    1 -
 merge-index.c           |    2 +-
 mktag.c                 |    2 +-
 object-refs.c           |    2 --
 pack-redundant.c        |    4 ++--
 patch-id.c              |    2 +-
 path-list.c             |    1 -
 pkt-line.c              |    2 +-
 read-cache.c            |   14 +++++++-------
 setup.c                 |    4 ++--
 sha1_file.c             |    8 ++++----
 shallow.c               |    1 -
 ssh-upload.c            |   10 +++++-----
 strbuf.c                |    1 -
 tree-walk.c             |    1 -
 upload-pack.c           |    2 +-
 var.c                   |    4 ++--
 xdiff-interface.c       |    2 --
 52 files changed, 68 insertions(+), 91 deletions(-)

diff --git a/builtin-annotate.c b/builtin-annotate.c
index 9db7cfe..fc43eed 100644
--- a/builtin-annotate.c
+++ b/builtin-annotate.c
@@ -22,4 +22,3 @@ int cmd_annotate(int argc, const char **argv, const
char *prefix)

 	return cmd_blame(argc + 1, nargv, prefix);
 }
-
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index d90eba9..81e7167 100644
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
@@ -23,7 +23,7 @@ int cmd_diff_index(int argc, const char **argv,
const char *prefix)
 	argc = setup_revisions(argc, argv, &rev, NULL);
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
-			
+
 		if (!strcmp(arg, "--cached"))
 			cached = 1;
 		else
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 5c145d2..ae60fcc 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -357,4 +357,3 @@ int cmd_fmt_merge_msg(int argc, const char **argv,
const char *prefix)

 	return 0;
 }
-
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 44ce629..3c7e30d 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -336,7 +336,7 @@ static int fsck_commit(struct commit *commit)
 	if (!commit->parents && show_root)
 		printf("root %s\n", sha1_to_hex(commit->object.sha1));
 	if (!commit->date)
-		printf("bad commit date in %s\n",
+		printf("bad commit date in %s\n",
 		       sha1_to_hex(commit->object.sha1));
 	return 0;
 }
@@ -676,7 +676,7 @@ int cmd_fsck(int argc, char **argv, const char *prefix)

 	heads = 0;
 	for (i = 1; i < argc; i++) {
-		const char *arg = argv[i];
+		const char *arg = argv[i];

 		if (*arg == '-')
 			continue;
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index f7c066b..5398a41 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -117,7 +117,7 @@ static void show_other_files(struct dir_struct *dir)
 		if (0 <= pos)
 			continue;	/* exact match */
 		pos = -pos - 1;
-		if (pos < active_nr) {
+		if (pos < active_nr) {
 			ce = active_cache[pos];
 			if (ce_namelen(ce) == len &&
 			    !memcmp(ce->name, ent->name, len))
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index c022224..c696b35 100644
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
@@ -272,4 +272,3 @@ int cmd_name_rev(int argc, const char **argv,
const char *prefix)

 	return 0;
 }
-
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 966f843..dda7d2e 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -28,7 +28,7 @@ struct object_entry {
 	unsigned long size;	/* uncompressed size */
 	unsigned int hash;	/* name hint hash */
 	unsigned int depth;	/* delta depth */
-	struct packed_git *in_pack; 	/* already in pack */
+	struct packed_git *in_pack;	/* already in pack */
 	off_t in_pack_offset;
 	struct object_entry *delta;	/* delta base object */
 	struct object_entry *delta_child; /* deltified objects who bases me */
@@ -242,7 +242,7 @@ static void *delta_against(void *buf, unsigned
long size, struct object_entry *e
         delta_buf = diff_delta(otherbuf, othersize,
 			       buf, size, &delta_size, 0);
         if (!delta_buf || delta_size != entry->delta_size)
-        	die("delta size changed");
+		die("delta size changed");
         free(buf);
         free(otherbuf);
 	return delta_buf;
diff --git a/builtin-rerere.c b/builtin-rerere.c
index 8c2c8bd..f6409b9 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -434,4 +434,3 @@ int cmd_rerere(int argc, const char **argv, const
char *prefix)
 	path_list_clear(&merge_rr, 1);
 	return 0;
 }
-
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 8d3f742..16af619 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -331,4 +331,3 @@ int cmd_shortlog(int argc, const char **argv,
const char *prefix)

 	return 0;
 }
-
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index b04719e..8861a29 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -21,7 +21,7 @@ int cmd_tar_tree(int argc, const char **argv, const
char *prefix)
 	 * $0 tree-ish ==>
 	 *	git-archive --format=tar tree-ish
 	 * $0 tree-ish basedir ==>
-	 * 	git-archive --format-tar --prefix=basedir tree-ish
+	 *	git-archive --format-tar --prefix=basedir tree-ish
 	 */
 	int i;
 	const char **nargv = xcalloc(sizeof(*nargv), argc + 2);
diff --git a/commit.c b/commit.c
index d01833d..06f3c30 100644
--- a/commit.c
+++ b/commit.c
@@ -148,7 +148,7 @@ static int commit_graft_pos(const unsigned char *sha1)
 int register_commit_graft(struct commit_graft *graft, int ignore_dups)
 {
 	int pos = commit_graft_pos(graft->sha1);
-	
+
 	if (0 <= pos) {
 		if (ignore_dups)
 			free(graft);
@@ -406,7 +406,7 @@ struct commit_list * insert_by_date(struct commit
*item, struct commit_list **li
 	return commit_list_insert(item, pp);
 }

-	
+
 void sort_by_date(struct commit_list **list)
 {
 	struct commit_list *ret = NULL;
@@ -1155,7 +1155,7 @@ void sort_in_topological_order_fn(struct
commit_list ** list, int lifo,
 		next = next->next;
 		count++;
 	}
-	
+
 	if (!count)
 		return;
 	/* allocate an array to help sort the list */
@@ -1183,11 +1183,11 @@ void sort_in_topological_order_fn(struct
commit_list ** list, int lifo,
 		}
 		next=next->next;
 	}
-	/*
+	/*
          * find the tips
          *
-         * tips are nodes not reachable from any other node in the list
-         *
+         * tips are nodes not reachable from any other node in the list
+         *
          * the tips serve as a starting set for the work queue.
          */
 	next=*list;
@@ -1215,7 +1215,7 @@ void sort_in_topological_order_fn(struct
commit_list ** list, int lifo,

 			if (pn) {
 				/*
-				 * parents are only enqueued for emission
+				 * parents are only enqueued for emission
                                  * when all their children have been
emitted thereby
                                  * guaranteeing topological order.
                                  */
diff --git a/config.c b/config.c
index 70d1055..47e4f42 100644
--- a/config.c
+++ b/config.c
@@ -590,7 +590,7 @@ static ssize_t find_beginning_of_line(const char*
contents, size_t size,
 	size_t equal_offset = size, bracket_offset = size;
 	ssize_t offset;

-	for (offset = offset_-2; offset > 0
+	for (offset = offset_-2; offset > 0
 			&& contents[offset] != '\n'; offset--)
 		switch (contents[offset]) {
 			case '=': equal_offset = offset; break;
@@ -958,4 +958,3 @@ int git_config_rename_section(const char
*old_name, const char *new_name)
 	free(config_filename);
 	return ret;
 }
-
diff --git a/connect.c b/connect.c
index da89c9c..4382d43 100644
--- a/connect.c
+++ b/connect.c
@@ -574,7 +574,7 @@ static int git_proxy_command_options(const char
*var, const char *value)
 		}
 		if (0 <= matchlen) {
 			/* core.gitproxy = none for kernel.org */
-			if (matchlen == 4 &&
+			if (matchlen == 4 &&
 			    !memcmp(value, "none", 4))
 				matchlen = 0;
 			git_proxy_command = xmalloc(matchlen + 1);
diff --git a/convert-objects.c b/convert-objects.c
index cefbceb..90e7900 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -194,7 +194,7 @@ static unsigned long parse_oldstyle_date(const char *buf)
 		fmt++;
 	} while (*buf && *fmt);
 	printf("left: %s\n", buf);
-	return mktime(&tm);				
+	return mktime(&tm);
 }

 static int convert_date_line(char *dst, void **buf, unsigned long *sp)
diff --git a/copy.c b/copy.c
index 08a3d38..d9b0810 100644
--- a/copy.c
+++ b/copy.c
@@ -35,4 +35,3 @@ int copy_fd(int ifd, int ofd)
 	close(ifd);
 	return 0;
 }
-
diff --git a/ctype.c b/ctype.c
index 56bdffa..ee06eb7 100644
--- a/ctype.c
+++ b/ctype.c
@@ -20,4 +20,3 @@ unsigned char sane_ctype[256] = {
 	AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA,  0,  0,  0,  0,  0,		/* 112-15 */
 	/* Nothing in the 128.. range */
 };
-
diff --git a/daemon.c b/daemon.c
index e74ecac..a30324f 100644
--- a/daemon.c
+++ b/daemon.c
@@ -133,7 +133,7 @@ static int avoid_alias(char *p)
 {
 	int sl, ndot;

-	/*
+	/*
 	 * This resurrects the belts and suspenders paranoia check by HPA
 	 * done in <435560F7.4080006@zytor.com> thread, now enter_repo()
 	 * does not do getcwd() based path canonicalizations.
@@ -247,7 +247,7 @@ static char *path_ok(struct interp *itable)
 		int pathlen = strlen(path);

 		/* The validation is done on the paths after enter_repo
-		 * appends optional {.git,.git/.git} and friends, but
+		 * appends optional {.git,.git/.git} and friends, but
 		 * it does not use getcwd().  So if your /pub is
 		 * a symlink to /mnt/pub, you can whitelist /pub and
 		 * do not have to say /mnt/pub.
diff --git a/date.c b/date.c
index a9b59a2..a5407f5 100644
--- a/date.c
+++ b/date.c
@@ -403,7 +403,7 @@ static int match_multi_number(unsigned long num,
char c, const char *date, char
 }

 /*
- * We've seen a digit. Time? Year? Date?
+ * We've seen a digit. Time? Year? Date?
  */
 static int match_digit(const char *date, struct tm *tm, int *offset,
int *tm_gmt)
 {
@@ -493,7 +493,7 @@ static int match_digit(const char *date, struct tm
*tm, int *offset, int *tm_gmt
 	} else if (num > 0 && num < 13) {
 		tm->tm_mon = num-1;
 	}
-		
+
 	return n;
 }

@@ -567,13 +567,13 @@ int parse_date(const char *date, char *result, int maxlen)
 		if (!match) {
 			/* BAD CRAP */
 			match = 1;
-		}	
+		}

 		date += match;
 	}

 	/* mktime uses local timezone */
-	then = my_mktime(&tm);
+	then = my_mktime(&tm);
 	if (offset == -1)
 		offset = (then - mktime(&tm)) / 60;

@@ -689,7 +689,7 @@ static const struct typelen {
 	{ "days", 24*60*60 },
 	{ "weeks", 7*24*60*60 },
 	{ NULL }
-};	
+};

 static const char *approxidate_alpha(const char *date, struct tm *tm, int *num)
 {
diff --git a/diff-lib.c b/diff-lib.c
index 07f4e81..7fb19c7 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -664,7 +664,7 @@ int run_diff_index(struct rev_info *revs, int cached)
 	const char *tree_name;
 	int match_missing = 0;

-	/*
+	/*
 	 * Backward compatibility wart - "diff-index -m" does
 	 * not mean "do not ignore merges", but totally different.
 	 */
diff --git a/diff.c b/diff.c
index 8354e71..faff76a 100644
--- a/diff.c
+++ b/diff.c
@@ -3038,7 +3038,7 @@ void diff_addremove(struct diff_options *options,
 	 * entries to the diff-core.  They will be prefixed
 	 * with something like '=' or '*' (I haven't decided
 	 * which but should not make any difference).
-	 * Feeding the same new and old to diff_change()
+	 * Feeding the same new and old to diff_change()
 	 * also has the same effect.
 	 * Before the final output happens, they are pruned after
 	 * merged into rename/copy pairs as appropriate.
@@ -3065,7 +3065,7 @@ void diff_change(struct diff_options *options,
 		 unsigned old_mode, unsigned new_mode,
 		 const unsigned char *old_sha1,
 		 const unsigned char *new_sha1,
-		 const char *base, const char *path)
+		 const char *base, const char *path)
 {
 	char concatpath[PATH_MAX];
 	struct diff_filespec *one, *two;
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index c4a77d7..af9fffe 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -102,7 +102,7 @@ void diffcore_pickaxe(const char *needle, int opts)
 		for (i = 0; i < q->nr; i++)
 			diff_free_filepair(q->queue[i]);
 	}
-	else
+	else
 		/* Showing only the filepairs that has the needle */
 		for (i = 0; i < q->nr; i++) {
 			struct diff_filepair *p = q->queue[i];
diff --git a/entry.c b/entry.c
index 82bf725..581de3f 100644
--- a/entry.c
+++ b/entry.c
@@ -31,7 +31,7 @@ static void remove_subtree(const char *path)
 	struct dirent *de;
 	char pathbuf[PATH_MAX];
 	char *name;
-	
+
 	if (!dir)
 		die("cannot opendir %s (%s)", path, strerror(errno));
 	strcpy(pathbuf, path);
diff --git a/environment.c b/environment.c
index 2231659..a8855d3 100644
--- a/environment.c
+++ b/environment.c
@@ -104,5 +104,3 @@ char *get_graft_file(void)
 		setup_git_env();
 	return git_graft_file;
 }
-
-
diff --git a/fetch-pack.c b/fetch-pack.c
index 06f4aec..b6cb655 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -114,7 +114,7 @@ static const unsigned char* get_rev(void)
 		commit->object.flags |= POPPED;
 		if (!(commit->object.flags & COMMON))
 			non_common_revs--;
-	
+
 		parents = commit->parents;

 		if (commit->object.flags & COMMON) {
diff --git a/fetch.c b/fetch.c
index 8e29d31..dda33e5 100644
--- a/fetch.c
+++ b/fetch.c
@@ -15,7 +15,7 @@ int get_verbosely = 0;
 int get_recover = 0;
 static unsigned char current_commit_sha1[20];

-void pull_say(const char *fmt, const char *hex)
+void pull_say(const char *fmt, const char *hex)
 {
 	if (get_verbosely)
 		fprintf(stderr, fmt, hex);
@@ -153,7 +153,7 @@ static int process(struct object *obj)
 			return 0;
 		prefetch(obj->sha1);
 	}
-		
+
 	object_list_insert(obj, process_queue_end);
 	process_queue_end = &(*process_queue_end)->next;
 	return 0;
diff --git a/git.c b/git.c
index f200907..664a638 100644
--- a/git.c
+++ b/git.c
@@ -214,7 +214,7 @@ const char git_version_string[] = GIT_VERSION;
  * require working tree to be present -- anything uses this needs
  * RUN_SETUP for reading from the configuration file.
  */
-#define NOT_BARE 	(1<<2)
+#define NOT_BARE	(1<<2)

 static void handle_internal_command(int argc, const char **argv, char **envp)
 {
diff --git a/help.c b/help.c
index 6a9af4d..1cd33ec 100644
--- a/help.c
+++ b/help.c
@@ -219,5 +219,3 @@ int cmd_help(int argc, const char **argv, const
char *prefix)

 	return 0;
 }
-
-
diff --git a/http-fetch.c b/http-fetch.c
index 09baedc..202fae0 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -828,7 +828,7 @@ static void abort_object_request(struct
object_request *obj_req)
 	}
 	unlink(obj_req->tmpfile);
 	if (obj_req->slot) {
- 		release_active_slot(obj_req->slot);
+		release_active_slot(obj_req->slot);
 		obj_req->slot = NULL;
 	}
 	release_object_request(obj_req);
diff --git a/http-push.c b/http-push.c
index e3f7675..c54ad9d 100644
--- a/http-push.c
+++ b/http-push.c
@@ -517,7 +517,7 @@ static void start_put(struct transfer_request *request)
 	request->buffer.size = stream.total_out;
 	request->buffer.posn = 0;

-	request->url = xmalloc(strlen(remote->url) +
+	request->url = xmalloc(strlen(remote->url) +
 			       strlen(request->lock->token) + 51);
 	strcpy(request->url, remote->url);
 	posn = request->url + strlen(remote->url);
diff --git a/http.c b/http.c
index ae27e0c..c6fb8ac 100644
--- a/http.c
+++ b/http.c
@@ -137,7 +137,7 @@ static int http_options(const char *var, const char *value)
 		return 0;
 	}

-#ifdef USE_CURL_MULTI	
+#ifdef USE_CURL_MULTI
 	if (!strcmp("http.maxrequests", var)) {
 		if (max_requests == -1)
 			max_requests = git_config_int(var, value);
diff --git a/imap-send.c b/imap-send.c
index 84df2fa..2b7471c 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1239,7 +1239,7 @@ split_msg( msg_data_t *all_msgs, msg_data_t
*msg, int *ofs )
 	msg->data[ msg->len ] = 0;

 	*ofs += msg->len;
- 	return 1;
+	return 1;
 }

 static imap_server_conf_t server =
diff --git a/local-fetch.c b/local-fetch.c
index 4b650ef..bf7ec6c 100644
--- a/local-fetch.c
+++ b/local-fetch.c
@@ -114,7 +114,7 @@ static int fetch_pack(const unsigned char *sha1)
 		return -1;
 	target = find_sha1_pack(sha1, packs);
 	if (!target)
-		return error("Couldn't find %s: not separate or in any pack",
+		return error("Couldn't find %s: not separate or in any pack",
 			     sha1_to_hex(sha1));
 	if (get_verbosely) {
 		fprintf(stderr, "Getting pack %s\n",
@@ -122,11 +122,11 @@ static int fetch_pack(const unsigned char *sha1)
 		fprintf(stderr, " which contains %s\n",
 			sha1_to_hex(sha1));
 	}
-	sprintf(filename, "%s/objects/pack/pack-%s.pack",
+	sprintf(filename, "%s/objects/pack/pack-%s.pack",
 		path, sha1_to_hex(target->sha1));
 	copy_file(filename, sha1_pack_name(target->sha1),
 		  sha1_to_hex(target->sha1), 1);
-	sprintf(filename, "%s/objects/pack/pack-%s.idx",
+	sprintf(filename, "%s/objects/pack/pack-%s.idx",
 		path, sha1_to_hex(target->sha1));
 	copy_file(filename, sha1_pack_index_name(target->sha1),
 		  sha1_to_hex(target->sha1), 1);
@@ -141,7 +141,7 @@ static int fetch_file(const unsigned char *sha1)
 	char *hex = sha1_to_hex(sha1);
 	char *dest_filename = sha1_file_name(sha1);

- 	if (object_name_start < 0) {
+	if (object_name_start < 0) {
 		strcpy(filename, path); /* e.g. git.git */
 		strcat(filename, "/objects/");
 		object_name_start = strlen(filename);
diff --git a/lockfile.c b/lockfile.c
index 23db35a..5ad2858 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -97,4 +97,3 @@ void rollback_lock_file(struct lock_file *lk)
 		unlink(lk->filename);
 	lk->filename[0] = 0;
 }
-
diff --git a/mailmap.c b/mailmap.c
index cb567a2..8714167 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -89,4 +89,3 @@ int map_email(struct path_list *map, const char
*email, char *name, int maxlen)
 	}
 	return 0;
 }
-
diff --git a/match-trees.c b/match-trees.c
index 23cafe4..d7e29c4 100644
--- a/match-trees.c
+++ b/match-trees.c
@@ -301,4 +301,3 @@ void shift_tree(const unsigned char *hash1,

 	splice_tree(hash1, add_prefix, hash2, shifted);
 }
-
diff --git a/merge-index.c b/merge-index.c
index 5599fd3..fa719cb 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -25,7 +25,7 @@ static void run_program(void)
 static int merge_entry(int pos, const char *path)
 {
 	int found;
-	
+
 	if (pos >= active_nr)
 		die("git-merge-index: %s not in the cache", path);
 	arguments[0] = pgm;
diff --git a/mktag.c b/mktag.c
index 9310111..070bc96 100644
--- a/mktag.c
+++ b/mktag.c
@@ -11,7 +11,7 @@
  * The first three lines are guaranteed to be at least 63 bytes:
  * "object <sha1>\n" is 48 bytes, "type tag\n" at 9 bytes is the
  * shortest possible type-line, and "tag .\n" at 6 bytes is the
- * shortest single-character-tag line.
+ * shortest single-character-tag line.
  *
  * We also artificially limit the size of the full object to 8kB.
  * Just because I'm a lazy bastard, and if you can't fit a signature
diff --git a/object-refs.c b/object-refs.c
index 022e8d8..5345671 100644
--- a/object-refs.c
+++ b/object-refs.c
@@ -85,5 +85,3 @@ void mark_reachable(struct object *obj, unsigned int mask)
 			mark_reachable(refs->ref[i], mask);
 	}
 }
-
-
diff --git a/pack-redundant.c b/pack-redundant.c
index 87077e1..876071f 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -81,7 +81,7 @@ static struct llist * llist_copy(struct llist *list)
 {
 	struct llist *ret;
 	struct llist_item *new, *old, *prev;
-	
+
 	llist_init(&ret);

 	if ((ret->size = list->size) == 0)
@@ -100,7 +100,7 @@ static struct llist * llist_copy(struct llist *list)
 	}
 	new->next = NULL;
 	ret->back = new;
-	
+
 	return ret;
 }

diff --git a/patch-id.c b/patch-id.c
index 086d2d9..9349bc5 100644
--- a/patch-id.c
+++ b/patch-id.c
@@ -81,4 +81,4 @@ int main(int argc, char **argv)

 	generate_id_list();
 	return 0;
-}	
+}
diff --git a/path-list.c b/path-list.c
index caaa5cc..dcb4b3a 100644
--- a/path-list.c
+++ b/path-list.c
@@ -100,4 +100,3 @@ void print_path_list(const char *text, const
struct path_list *p)
 	for (i = 0; i < p->nr; i++)
 		printf("%s:%p\n", p->items[i].path, p->items[i].util);
 }
-
diff --git a/pkt-line.c b/pkt-line.c
index b4cb7e2..cb831af 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -5,7 +5,7 @@
  * Write a packetized stream, where each line is preceded by
  * its length (including the header) as a 4-byte hex number.
  * A length of 'zero' means end of stream (and a length of 1-3
- * would be an error).
+ * would be an error).
  *
  * This is all pretty stupid, but we use this packetized line
  * format to make a streaming format possible without ever
diff --git a/read-cache.c b/read-cache.c
index d9f46da..922046f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -166,7 +166,7 @@ static int ce_match_stat_basic(struct cache_entry
*ce, struct stat *st)
 		changed |= MTIME_CHANGED;
 	if (ce->ce_ctime.nsec != htonl(st->st_ctim.tv_nsec))
 		changed |= CTIME_CHANGED;
-#endif	
+#endif

 	if (ce->ce_uid != htonl(st->st_uid) ||
 	    ce->ce_gid != htonl(st->st_gid))
@@ -208,9 +208,9 @@ int ie_match_stat(struct index_state *istate,

 	/*
 	 * Within 1 second of this sequence:
-	 * 	echo xyzzy >file && git-update-index --add file
+	 *	echo xyzzy >file && git-update-index --add file
 	 * running this command:
-	 * 	echo frotz >file
+	 *	echo frotz >file
 	 * would give a falsely clean cache entry.  The mtime and
 	 * length match the cache, and other stat fields do not change.
 	 *
@@ -597,7 +597,7 @@ static int has_dir_name(struct index_state *istate,
  * is being added, or we already have path and path/file is being
  * added.  Either one would result in a nonsense tree that has path
  * twice when git-write-tree tries to write it out.  Prevent it.
- *
+ *
  * If ok-to-replace is specified, we remove the conflicting entries
  * from the cache so the caller should recompute the insert position.
  * When this happens, we return non-zero.
@@ -970,8 +970,8 @@ static int ce_write(SHA_CTX *context, int fd, void
*data, unsigned int len)
 		write_buffer_len = buffered;
 		len -= partial;
 		data = (char *) data + partial;
- 	}
- 	return 0;
+	}
+	return 0;
 }

 static int write_index_ext_header(SHA_CTX *context, int fd,
@@ -1037,7 +1037,7 @@ static void ce_smudge_racily_clean_entry(struct
cache_entry *ce)
 		 * size to zero here, then the object name recorded
 		 * in index is the 6-byte file but the cached stat information
 		 * becomes zero --- which would then match what we would
-		 * obtain from the filesystem next time we stat("frotz").
+		 * obtain from the filesystem next time we stat("frotz").
 		 *
 		 * However, the second update-index, before calling
 		 * this function, notices that the cached size is 6
diff --git a/setup.c b/setup.c
index a45ea83..14f62c4 100644
--- a/setup.c
+++ b/setup.c
@@ -39,7 +39,7 @@ const char *prefix_path(const char *prefix, int len,
const char *path)
 	if (len) {
 		int speclen = strlen(path);
 		char *n = xmalloc(speclen + len + 1);
-	
+
 		memcpy(n, prefix, len);
 		memcpy(n + len, path, speclen+1);
 		path = n;
@@ -47,7 +47,7 @@ const char *prefix_path(const char *prefix, int len,
const char *path)
 	return path;
 }

-/*
+/*
  * Unlike prefix_path, this should be used if the named file does
  * not have to interact with index entry; i.e. name of a random file
  * on the filesystem.
diff --git a/sha1_file.c b/sha1_file.c
index 32244d7..911eaec 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -193,7 +193,7 @@ char *sha1_pack_name(const unsigned char *sha1)
 		*buf++ = hex[val >> 4];
 		*buf++ = hex[val & 0xf];
 	}
-	
+
 	return base;
 }

@@ -218,7 +218,7 @@ char *sha1_pack_index_name(const unsigned char *sha1)
 		*buf++ = hex[val >> 4];
 		*buf++ = hex[val & 0xf];
 	}
-	
+
 	return base;
 }

@@ -1109,7 +1109,7 @@ static int parse_sha1_header(const char *hdr,
unsigned long *sizep)
 	unsigned long size;

 	/*
-	 * The type can be at most ten bytes (including the
+	 * The type can be at most ten bytes (including the
 	 * terminating '\0' that we add), and is followed by
 	 * a space.
 	 */
@@ -1683,7 +1683,7 @@ static int find_pack_entry(const unsigned char
*sha1, struct pack_entry *e, cons
 	return 0;
 }

-struct packed_git *find_sha1_pack(const unsigned char *sha1,
+struct packed_git *find_sha1_pack(const unsigned char *sha1,
 				  struct packed_git *packs)
 {
 	struct packed_git *p;
diff --git a/shallow.c b/shallow.c
index d178689..dbd9f5a 100644
--- a/shallow.c
+++ b/shallow.c
@@ -101,4 +101,3 @@ struct commit_list *get_shallow_commits(struct
object_array *heads, int depth,

 	return result;
 }
-
diff --git a/ssh-upload.c b/ssh-upload.c
index 2f04572..ca0003f 100644
--- a/ssh-upload.c
+++ b/ssh-upload.c
@@ -29,24 +29,24 @@ static int serve_object(int fd_in, int fd_out) {
 	}
 	if (!size)
 		return -1;
-	
+
 	if (verbose)
 		fprintf(stderr, "Serving %s\n", sha1_to_hex(sha1));

 	remote = 0;
-	
+
 	if (!has_sha1_file(sha1)) {
 		fprintf(stderr, "git-ssh-upload: could not find %s\n",
 			sha1_to_hex(sha1));
 		remote = -1;
 	}
-	
+
 	if (write_in_full(fd_out, &remote, 1) != 1)
 		return 0;
-	
+
 	if (remote < 0)
 		return 0;
-	
+
 	return write_sha1_to_fd(fd_out, sha1);
 }

diff --git a/strbuf.c b/strbuf.c
index 7f14b0f..e33d06b 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -39,4 +39,3 @@ void read_line(struct strbuf *sb, FILE *fp, int term) {
 		sb->eof = 1;
 	strbuf_end(sb);
 }
-
diff --git a/tree-walk.c b/tree-walk.c
index cbb24eb..8d4b673 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -206,4 +206,3 @@ int get_tree_entry(const unsigned char *tree_sha1,
const char *name, unsigned ch
 	free(tree);
 	return retval;
 }
-
diff --git a/upload-pack.c b/upload-pack.c
index d3a09e7..0e881c8 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -678,7 +678,7 @@ int main(int argc, char **argv)
 			break;
 		}
 	}
-	
+
 	if (i != argc-1)
 		usage(upload_pack_usage);
 	dir = argv[i];
diff --git a/var.c b/var.c
index e585e59..4127031 100644
--- a/var.c
+++ b/var.c
@@ -67,8 +67,8 @@ int main(int argc, char **argv)
 	val = read_var(argv[1]);
 	if (!val)
 		usage(var_usage);
-	
+
 	printf("%s\n", val);
-	
+
 	return 0;
 }
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 10816e9..3421efd 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -121,5 +121,3 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
 	ptr->size = sz;
 	return 0;
 }
-
-
-- 
1.5.2.rc3

^ permalink raw reply related

* [PATCH 2/3] Fix assorted white space damage in *.h files
From: Marco Costalba @ 2007-05-12 11:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Used the new 'cleanfile' script by H. Peter Anvin, just merged
in Linux tree.

This script cleans up various classes of stealth whitespace.  In
particular, it cleans up:

  - Whitespace (spaces or tabs)before newline;
  - DOS line endings (CR before LF);
  - Space before tab (spaces are deleted or converted to tabs);
  - Empty lines at end of file.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
 cache.h  |    2 +-
 commit.h |    2 +-
 diff.h   |    2 +-
 object.h |    2 +-
 rsh.h    |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cache.h b/cache.h
index 8e76152..7b81d01 100644
--- a/cache.h
+++ b/cache.h
@@ -479,7 +479,7 @@ extern void prepare_packed_git(void);
 extern void reprepare_packed_git(void);
 extern void install_packed_git(struct packed_git *pack);

-extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
+extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
 					 struct packed_git *packs);

 extern void pack_report(void);
diff --git a/commit.h b/commit.h
index 86e8dca..75b43a5 100644
--- a/commit.h
+++ b/commit.h
@@ -66,7 +66,7 @@ extern unsigned long pretty_print_commit(enum
cmit_fmt fmt, const struct commit
 /** Removes the first commit from a list sorted by date, and adds all
  * of its parents.
  **/
-struct commit *pop_most_recent_commit(struct commit_list **list,
+struct commit *pop_most_recent_commit(struct commit_list **list,
 				      unsigned int mark);

 struct commit *pop_commit(struct commit_list **stack);
diff --git a/diff.h b/diff.h
index 63738c1..f7e6377 100644
--- a/diff.h
+++ b/diff.h
@@ -157,7 +157,7 @@ extern void diff_unmerge(struct diff_options *,

 extern int diff_scoreopt_parse(const char *opt);

-#define DIFF_SETUP_REVERSE      	1
+#define DIFF_SETUP_REVERSE		1
 #define DIFF_SETUP_USE_CACHE		2
 #define DIFF_SETUP_USE_SIZE_CACHE	4

diff --git a/object.h b/object.h
index 94f19ee..397bbfa 100644
--- a/object.h
+++ b/object.h
@@ -66,7 +66,7 @@ void set_object_refs(struct object *obj, struct
object_refs *refs);

 void mark_reachable(struct object *obj, unsigned int mask);

-struct object_list *object_list_insert(struct object *item,
+struct object_list *object_list_insert(struct object *item,
 				       struct object_list **list_p);

 void object_list_append(struct object *item,
diff --git a/rsh.h b/rsh.h
index 3b41942..ee2f499 100644
--- a/rsh.h
+++ b/rsh.h
@@ -1,7 +1,7 @@
 #ifndef RSH_H
 #define RSH_H

-int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
+int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
 		     char *url, int rmt_argc, char **rmt_argv);

 #endif
-- 
1.5.2.rc3

^ permalink raw reply related

* [PATCH 3/3] Fix assorted white space damage in script files
From: Marco Costalba @ 2007-05-12 11:13 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Used the new 'cleanfile' script by H. Peter Anvin, just merged
in Linux tree.

This script cleans up various classes of stealth whitespace.  In
particular, it cleans up:

  - Whitespace (spaces or tabs)before newline;
  - DOS line endings (CR before LF);
  - Space before tab (spaces are deleted or converted to tabs);
  - Empty lines at end of file.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
 git-applymbox.sh         |    4 +-
 git-archimport.perl      |  177 +++++++++++++++++++++++-----------------------
 git-checkout.sh          |    4 +-
 git-clean.sh             |    2 +-
 git-clone.sh             |    5 +-
 git-commit.sh            |    2 +-
 git-cvsexportcommit.perl |    2 +-
 git-cvsimport.perl       |   12 ++--
 git-fetch.sh             |    2 +-
 git-merge-one-file.sh    |    2 +-
 git-p4import.py          |    1 -
 git-svn.perl             |    2 +-
 git-svnimport.perl       |    4 +-
 git-tag.sh               |    5 +-
 git-verify-tag.sh        |    1 -
 gitk                     |    2 +-
 16 files changed, 111 insertions(+), 116 deletions(-)

diff --git a/git-applymbox.sh b/git-applymbox.sh
index c18e80f..c51b2ff 100755
--- a/git-applymbox.sh
+++ b/git-applymbox.sh
@@ -69,7 +69,7 @@ set x .dotest/0*
 shift
 while case "$#" in 0) break;; esac
 do
-    i="$1"
+    i="$1"
     case "$resume,$continue" in
     f,$i)	resume=t;;
     f,*)	shift
@@ -94,7 +94,7 @@ do
 		;;
 	2)
 		# 2 is a special exit code from applypatch to indicate that
-	    	# the patch wasn't applied, but continue anyway
+		# the patch wasn't applied, but continue anyway
 		;;
 	*)
 		ret=$?
diff --git a/git-archimport.perl b/git-archimport.perl
index c1e7c1d..fee785f 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -3,19 +3,19 @@
 # This tool is copyright (c) 2005, Martin Langhoff.
 # It is released under the Gnu Public License, version 2.
 #
-# The basic idea is to walk the output of tla abrowse,
-# fetch the changesets and apply them.
+# The basic idea is to walk the output of tla abrowse,
+# fetch the changesets and apply them.
 #

 =head1 Invocation

-    git-archimport [ -h ] [ -v ] [ -o ] [ -a ] [ -f ] [ -T ]
-    	[ -D depth] [ -t tempdir ] <archive>/<branch> [ <archive>/<branch> ]
+    git-archimport [ -h ] [ -v ] [ -o ] [ -a ] [ -f ] [ -T ]
+	[ -D depth] [ -t tempdir ] <archive>/<branch> [ <archive>/<branch> ]

 Imports a project from one or more Arch repositories. It will follow branches
 and repositories within the namespaces defined by the <archive/branch>
 parameters supplied. If it cannot find the remote branch a merge comes from
-it will just import it as a regular commit. If it can find it, it will mark it
+it will just import it as a regular commit. If it can find it, it will mark it
 as a merge whenever possible.

 See man (1) git-archimport for more details.
@@ -25,14 +25,14 @@ See man (1) git-archimport for more details.
  - create tag objects instead of ref tags
  - audit shell-escaping of filenames
  - hide our private tags somewhere smarter
- - find a way to make "cat *patches | patch" safe even when
patchfiles are missing newlines
+ - find a way to make "cat *patches | patch" safe even when
patchfiles are missing newlines
  - sort and apply patches by graphing ancestry relations instead of just
    relying in dates supplied in the changeset itself.
    tla ancestry-graph -m could be helpful here...

 =head1 Devel tricks

-Add print in front of the shell commands invoked via backticks.
+Add print in front of the shell commands invoked via backticks.

 =head1 Devel Notes

@@ -126,16 +126,16 @@ sub do_abrowse {
     my $stage = shift;
     while (my ($limit, $level) = each %arch_branches) {
         next unless $level == $stage;
-
-	open ABROWSE, "$TLA abrowse -fkD --merges $limit |"
+
+	open ABROWSE, "$TLA abrowse -fkD --merges $limit |"
                                 or die "Problems with tla abrowse: $!";
-
+
         my %ps        = ();         # the current one
         my $lastseen  = '';
-
+
         while (<ABROWSE>) {
             chomp;
-
+
             # first record padded w 8 spaces
             if (s/^\s{8}\b//) {
                 my ($id, $type) = split(m/\s+/, $_, 2);
@@ -147,13 +147,13 @@ sub do_abrowse {
                     push (@psets, \%last_ps);
                     $psets{ $last_ps{id} } = \%last_ps;
                 }
-
+
                 my $branch = extract_versionname($id);
                 %ps = ( id => $id, branch => $branch );
                 if (%last_ps && ($last_ps{branch} eq $branch)) {
                     $ps{parent_id} = $last_ps{id};
                 }
-
+
                 $arch_branches{$branch} = 1;
                 $lastseen = 'id';

@@ -166,16 +166,16 @@ sub do_abrowse {
                     $ps{type} = 't';
                     # read which revision we've tagged when we parse the log
                     $ps{tag}  = $1;
-                } else {
+                } else {
                     warn "Unknown type $type";
                 }

                 $arch_branches{$branch} = 1;
                 $lastseen = 'id';
-            } elsif (s/^\s{10}//) {
-                # 10 leading spaces or more
+            } elsif (s/^\s{10}//) {
+                # 10 leading spaces or more
                 # indicate commit metadata
-
+
                 # date
                 if ($lastseen eq 'id' && m/^(\d{4}-\d\d-\d\d \d\d:\d\d:\d\d)/){
                     $ps{date}   = $1;
@@ -186,12 +186,12 @@ sub do_abrowse {
                 } elsif ($lastseen eq 'merges' && s/^\s{2}//) {
                     my $id = $_;
                     push (@{$ps{merges}}, $id);
-
+
                     # aggressive branch finding:
                     if ($opt_D) {
                         my $branch = extract_versionname($id);
                         my $repo = extract_reponame($branch);
-
+
                         if (archive_reachable($repo) &&
                                 !defined $arch_branches{$branch}) {
                             $arch_branches{$branch} = $stage + 1;
@@ -208,10 +208,10 @@ sub do_abrowse {
             if (@psets && $psets[$#psets]{branch} eq $ps{branch}) {
                 $temp{parent_id} = $psets[$#psets]{id};
             }
-            push (@psets, \%temp);
+            push (@psets, \%temp);
             $psets{ $temp{id} } = \%temp;
-        }
-
+        }
+
         close ABROWSE or die "$TLA abrowse failed on $limit\n";
     }
 }                               # end foreach $root
@@ -253,7 +253,7 @@ unless (-d $git_dir) { # initial import
     while (my $file = readdir(DIR)) {
         # skip non-interesting-files
         next unless -f "$ptag_dir/$file";
-
+
         # convert first '--' to '/' from old git-archimport to use
         # as an archivename/c--b--v private tag
         if ($file !~ m!,!) {
@@ -275,7 +275,7 @@ sub extract_reponame {
     my $fq_cvbr = shift; # archivename/[[[[category]branch]version]revision]
     return (split(/\//, $fq_cvbr))[0];
 }
-
+
 sub extract_versionname {
     my $name = shift;
     $name =~ s/--(?:patch|version(?:fix)?|base)-\d+$//;
@@ -283,7 +283,7 @@ sub extract_versionname {
 }

 # convert a fully-qualified revision or version to a unique dirname:
-#   normalperson@yhbt.net-05/mpd--uclinux--1--patch-2
+#   normalperson@yhbt.net-05/mpd--uclinux--1--patch-2
 # becomes: normalperson@yhbt.net-05,mpd--uclinux--1
 #
 # the git notion of a branch is closer to
@@ -339,7 +339,7 @@ sub git_branchname {

 sub process_patchset_accurate {
     my $ps = shift;
-
+
     # switch to that branch if we're not already in that branch:
     if (-e "$git_dir/refs/heads/$ps->{branch}") {
        system('git-checkout','-f',$ps->{branch}) == 0 or die "$! $?\n";
@@ -348,7 +348,7 @@ sub process_patchset_accurate {
        my $rm = safe_pipe_capture('git-ls-files','--others','-z');
        rmtree(split(/\0/,$rm)) if $rm;
     }
-
+
     # Apply the import/changeset/merge into the working tree
     my $dir = sync_to_ps($ps);
     # read the new log entry:
@@ -361,9 +361,9 @@ sub process_patchset_accurate {
     parselog($ps, \@commitlog);

     if ($ps->{id} =~ /--base-0$/ && $ps->{id} ne $psets[0]{id}) {
-        # this should work when importing continuations
+        # this should work when importing continuations
         if ($ps->{tag} && (my $branchpoint = eval { ptag($ps->{tag}) })) {
-
+
             # find where we are supposed to branch from
 	    if (! -e "$git_dir/refs/heads/$ps->{branch}") {
 		system('git-branch',$ps->{branch},$branchpoint) == 0 or die "$! $?\n";
@@ -388,8 +388,8 @@ sub process_patchset_accurate {
         }
         # allow multiple bases/imports here since Arch supports cherry-picks
         # from unrelated trees
-    }
-
+    }
+
     # update the index with all the changes we got
     system('git-diff-files --name-only -z | '.
             'git-update-index --remove -z --stdin') == 0 or die "$! $?\n";
@@ -402,7 +402,7 @@ sub process_patchset_accurate {
 # does not handle permissions or any renames involving directories
 sub process_patchset_fast {
     my $ps = shift;
-    #
+    #
     # create the branch if needed
     #
     if ($ps->{type} eq 'i' && !$import) {
@@ -417,9 +417,9 @@ sub process_patchset_fast {
             # new branch! we need to verify a few things
             die "Branch on a non-tag!" unless $ps->{type} eq 't';
             my $branchpoint = ptag($ps->{tag});
-            die "Tagging from unknown id unsupported: $ps->{tag}"
+            die "Tagging from unknown id unsupported: $ps->{tag}"
                 unless $branchpoint;
-
+
             # find where we are supposed to branch from
 	    if (! -e "$git_dir/refs/heads/$ps->{branch}") {
 		system('git-branch',$ps->{branch},$branchpoint) == 0 or die "$! $?\n";
@@ -435,13 +435,13 @@ sub process_patchset_fast {
             }
             system('git-checkout',$ps->{branch}) == 0 or die "$! $?\n";
             return 0;
-        }
+        }
         die $! if $?;
-    }
+    }

     #
     # Apply the import/changeset/merge into the working tree
-    #
+    #
     if ($ps->{type} eq 'i' || $ps->{type} eq 't') {
         apply_import($ps) or die $!;
         $stats{import_or_tag}++;
@@ -455,10 +455,10 @@ sub process_patchset_fast {
     # prepare update git's index, based on what arch knows
     # about the pset, resolve parents, etc
     #
-
-    my @commitlog = safe_pipe_capture($TLA,'cat-archive-log',$ps->{id});
+
+    my @commitlog = safe_pipe_capture($TLA,'cat-archive-log',$ps->{id});
     die "Error in cat-archive-log: $!" if $?;
-
+
     parselog($ps,\@commitlog);

     # imports don't give us good info
@@ -485,10 +485,10 @@ sub process_patchset_fast {
         if (@$ren % 2) {
             die "Odd number of entries in rename!?";
         }
-
+
         while (@$ren) {
             my $from = shift @$ren;
-            my $to   = shift @$ren;
+            my $to   = shift @$ren;

             unless (-d dirname($to)) {
                 mkpath(dirname($to)); # will die on err
@@ -529,20 +529,20 @@ if ($opt_f) {
             "Things may be a bit slow\n";
     *process_patchset = *process_patchset_accurate;
 }
-
+
 foreach my $ps (@psets) {
     # process patchsets
     $ps->{branch} = git_branchname($ps->{id});

     #
-    # ensure we have a clean state
-    #
+    # ensure we have a clean state
+    #
     if (my $dirty = `git-diff-files`) {
         die "Unclean tree when about to process $ps->{id} " .
             " - did we fail to commit cleanly before?\n$dirty";
     }
     die $! if $?;
-
+
     #
     # skip commits already in repo
     #
@@ -559,7 +559,7 @@ foreach my $ps (@psets) {
     my $tree = `git-write-tree`;
     die "cannot write tree $!" if $?;
     chomp $tree;
-
+
     #
     # Who's your daddy?
     #
@@ -570,18 +570,18 @@ foreach my $ps (@psets) {
             close HEAD;
             chomp $p;
             push @par, '-p', $p;
-        } else {
+        } else {
             if ($ps->{type} eq 's') {
                 warn "Could not find the right head for the branch
$ps->{branch}";
             }
         }
     }
-
+
     if ($ps->{merges}) {
         push @par, find_parents($ps);
     }

-    #
+    #
     # Commit, tag and clean state
     #
     $ENV{TZ}                  = 'GMT';
@@ -592,14 +592,14 @@ foreach my $ps (@psets) {
     $ENV{GIT_COMMITTER_EMAIL} = $ps->{email};
     $ENV{GIT_COMMITTER_DATE}  = $ps->{date};

-    my $pid = open2(*READER, *WRITER,'git-commit-tree',$tree,@par)
+    my $pid = open2(*READER, *WRITER,'git-commit-tree',$tree,@par)
         or die $!;
     print WRITER $ps->{summary},"\n\n";
     print WRITER $ps->{message},"\n";
-
+
     # make it easy to backtrack and figure out which Arch revision this was:
     print WRITER 'git-archimport-id: ',$ps->{id},"\n";
-
+
     close WRITER;
     my $commitid = <READER>;    # read
     chomp $commitid;
@@ -611,7 +611,7 @@ foreach my $ps (@psets) {
     }
     #
     # Update the branch
-    #
+    #
     open  HEAD, ">","$git_dir/refs/heads/$ps->{branch}";
     print HEAD $commitid;
     close HEAD;
@@ -640,7 +640,7 @@ exit 0;
 sub sync_to_ps {
     my $ps = shift;
     my $tree_dir = $tmp.'/'.tree_dirname($ps->{id});
-
+
     $opt_v && print "sync_to_ps($ps->{id}) method: ";

     if (-d $tree_dir) {
@@ -674,7 +674,7 @@ sub sync_to_ps {
         safe_pipe_capture($TLA,'get','--no-pristine',$ps->{id},$tree_dir);
         $stats{get_new}++;
     }
-
+
     # added -I flag to rsync since we're going to fast! AIEEEEE!!!!
     system('rsync','-aI','--delete','--exclude',$git_dir,
 #               '--exclude','.arch-inventory',
@@ -691,15 +691,15 @@ sub apply_import {
     mkpath($tmp);

     safe_pipe_capture($TLA,'get','-s','--no-pristine',$ps->{id},"$tmp/import");
-    die "Cannot get import: $!" if $?;
+    die "Cannot get import: $!" if $?;
     system('rsync','-aI','--delete', '--exclude',$git_dir,
 		'--exclude','.arch-ids','--exclude','{arch}',
 		"$tmp/import/", './');
     die "Cannot rsync import:$!" if $?;
-
+
     rmtree("$tmp/import");
     die "Cannot remove tempdir: $!" if $?;
-
+

     return 1;
 }
@@ -712,13 +712,13 @@ sub apply_cset {
     # get the changeset
     safe_pipe_capture($TLA,'get-changeset',$ps->{id},"$tmp/changeset");
     die "Cannot get changeset: $!" if $?;
-
+
     # apply patches
     if (`find $tmp/changeset/patches -type f -name '*.patch'`) {
         # this can be sped up considerably by doing
         #    (find | xargs cat) | patch
         # but that can get mucked up by patches
-        # with missing trailing newlines or the standard
+        # with missing trailing newlines or the standard
         # 'missing newline' flag in the patch - possibly
         # produced with an old/buggy diff.
         # slow and safe, we invoke patch once per patchfile
@@ -741,7 +741,7 @@ sub apply_cset {

     # bring in new files
     system('rsync','-aI','--exclude',$git_dir,
-    		'--exclude','.arch-ids',
+		'--exclude','.arch-ids',
 		'--exclude', '{arch}',
 		"$tmp/changeset/new-files-archive/",'./');

@@ -789,7 +789,7 @@ sub parselog {
         removed_files => 1,
         removed_directories => 1,
     );
-
+
     chomp (@$log);
     while ($_ = shift @$log) {
         if (/^Continuation-of:\s*(.*)/) {
@@ -828,7 +828,7 @@ sub parselog {
             }
         }
     }
-
+
     # drop leading empty lines from the log message
     while (@$log && $log->[0] eq '') {
 	shift @$log;
@@ -842,7 +842,7 @@ sub parselog {
 	$ps->{summary} = $log->[0] . '...';
     }
     $ps->{message} = join("\n",@$log);
-
+
     # skip Arch control files, unescape pika-escaped files
     foreach my $k (keys %want_headers) {
         next unless (defined $ps->{$k});
@@ -867,7 +867,7 @@ sub parselog {
 # write/read a tag
 sub tag {
     my ($tag, $commit) = @_;
-
+
     if ($opt_o) {
         $tag =~ s|/|--|g;
     } else {
@@ -875,7 +875,7 @@ sub tag {
 	$patchname =~ s/.*--//;
         $tag = git_branchname ($tag) . '--' . $patchname;
     }
-
+
     if ($commit) {
         open(C,">","$git_dir/refs/tags/$tag")
             or die "Cannot create tag $tag: $!\n";
@@ -902,8 +902,8 @@ sub ptag {
     my ($tag, $commit) = @_;

     # don't use subdirs for tags yet, it could screw up other porcelains
-    $tag =~ s|/|,|g;
-
+    $tag =~ s|/|,|g;
+
     my $tag_file = "$ptag_dir/$tag";
     my $tag_branch_dir = dirname($tag_file);
     mkpath($tag_branch_dir) unless (-d $tag_branch_dir);
@@ -915,7 +915,7 @@ sub ptag {
             or die "Cannot write tag $tag: $!\n";
         close(C)
             or die "Cannot write tag $tag: $!\n";
-	$rptags{$commit} = $tag
+	$rptags{$commit} = $tag
 	    unless $tag =~ m/--base-0$/;
     } else {                    # read
         # if the tag isn't there, return 0
@@ -941,7 +941,7 @@ sub find_parents {
     # Identify what branches are merging into me
     # and whether we are fully merged
     # git-merge-base <headsha> <headsha> should tell
-    # me what the base of the merge should be
+    # me what the base of the merge should be
     #
     my $ps = shift;

@@ -963,14 +963,14 @@ sub find_parents {
     }

     #
-    # foreach branch find a merge base and walk it to the
+    # foreach branch find a merge base and walk it to the
     # head where we are, collecting the merged patchsets that
     # Arch has recorded. Keep that in @have
     # Compare that with the commits on the other branch
     # between merge-base and the tip of the branch (@need)
     # and see if we have a series of consecutive patches
     # starting from the merge base. The tip of the series
-    # of consecutive patches merged is our new parent for
+    # of consecutive patches merged is our new parent for
     # that branch.
     #
     foreach my $branch (keys %branches) {
@@ -979,13 +979,13 @@ sub find_parents {
 	next unless -e "$git_dir/refs/heads/$branch";

 	my $mergebase = `git-merge-base $branch $ps->{branch}`;
- 	if ($?) {
- 	    # Don't die here, Arch supports one-way cherry-picking
- 	    # between branches with no common base (or any relationship
- 	    # at all beforehand)
- 	    warn "Cannot find merge base for $branch and $ps->{branch}";
- 	    next;
- 	}
+	if ($?) {
+	    # Don't die here, Arch supports one-way cherry-picking
+	    # between branches with no common base (or any relationship
+	    # at all beforehand)
+	    warn "Cannot find merge base for $branch and $ps->{branch}";
+	    next;
+	}
 	chomp $mergebase;

 	# now walk up to the mergepoint collecting what patches we have
@@ -1010,15 +1010,15 @@ sub find_parents {
 	# merge what we have with what ancestors have
 	%have = (%have, %ancestorshave);

-	# see what the remote branch has - these are the merges we
+	# see what the remote branch has - these are the merges we
 	# will want to have in a consecutive series from the mergebase
 	my $otherbranchtip = git_rev_parse($branch);
 	my @needraw = `git-rev-list --topo-order $otherbranchtip ^$mergebase`;
 	my @need;
-	foreach my $needps (@needraw) { 	# get the psets
+	foreach my $needps (@needraw) {		# get the psets
 	    $needps = commitid2pset($needps);
 	    # git-rev-list will also
-	    # list commits merged in via earlier
+	    # list commits merged in via earlier
 	    # merges. we are only interested in commits
 	    # from the branch we're looking at
 	    if ($branch eq $needps->{branch}) {
@@ -1054,7 +1054,7 @@ sub find_parents {
 	next unless ref    $psets{$p}{merges};
 	my @merges = @{$psets{$p}{merges}};
 	foreach my $merge (@merges) {
-	    if ($parents{$merge}) {
+	    if ($parents{$merge}) {
 		delete $parents{$merge};
 	    }
 	}
@@ -1079,10 +1079,10 @@ sub git_rev_parse {
 sub commitid2pset {
     my $commitid = shift;
     chomp $commitid;
-    my $name = $rptags{$commitid}
+    my $name = $rptags{$commitid}
 	|| die "Cannot find reverse tag mapping for $commitid";
     $name =~ s|,|/|;
-    my $ps   = $psets{$name}
+    my $ps   = $psets{$name}
 	|| (print Dumper(sort keys %psets)) && die "Cannot find patchset for $name";
     return $ps;
 }
@@ -1112,7 +1112,7 @@ sub archive_reachable {
     my $archive = shift;
     return 1 if $reachable{$archive};
     return 0 if $unreachable{$archive};
-
+
     if (system "$TLA whereis-archive $archive >/dev/null") {
         if ($opt_a && (system($TLA,'register-archive',
                       "http://mirrors.sourcecontrol.net/$archive") == 0)) {
@@ -1127,4 +1127,3 @@ sub archive_reachable {
         return 1;
     }
 }
-
diff --git a/git-checkout.sh b/git-checkout.sh
index ed7c2c5..1ea4226 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -210,7 +210,7 @@ else
 	esac

 	# Match the index to the working tree, and do a three-way.
-    	git diff-files --name-only | git update-index --remove --stdin &&
+	git diff-files --name-only | git update-index --remove --stdin &&
 	work=`git write-tree` &&
 	git read-tree $v --reset -u $new || exit

@@ -245,7 +245,7 @@ else
     (exit $saved_err)
 fi

-#
+#
 # Switch the HEAD pointer to the new branch if we
 # checked out a branch head, and remove any potential
 # old MERGE_HEAD's (subsequent commits will clearly not
diff --git a/git-clean.sh b/git-clean.sh
index 299309d..538d2f6 100755
--- a/git-clean.sh
+++ b/git-clean.sh
@@ -7,7 +7,7 @@ USAGE="[-d] [-f] [-n] [-q] [-x | -X] [--] <paths>..."
 LONG_USAGE='Clean untracked files from the working directory
 	-d	remove directories as well
 	-f	override clean.requireForce and clean anyway
-	-n 	don'\''t remove anything, just show what would be done
+	-n	don'\''t remove anything, just show what would be done
 	-q	be quiet, only report errors
 	-x	remove ignored files as well
 	-X	remove only ignored files
diff --git a/git-clone.sh b/git-clone.sh
index 70374aa..69ccd38 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -2,7 +2,7 @@
 #
 # Copyright (c) 2005, Linus Torvalds
 # Copyright (c) 2005, Junio C Hamano
-#
+#
 # Clone a repository into a different directory that does not yet exist.

 # See git-sh-setup why.
@@ -98,7 +98,7 @@ while
 	*,--na|*,--nak|*,--nake|*,--naked|\
 	*,-b|*,--b|*,--ba|*,--bar|*,--bare) bare=yes ;;
 	*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
-        *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
+        *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
           local_shared=yes; use_local=yes ;;
 	1,--template) usage ;;
 	*,--template)
@@ -410,4 +410,3 @@ fi
 rm -f "$GIT_DIR/CLONE_HEAD" "$GIT_DIR/REMOTE_HEAD"

 trap - 0
-
diff --git a/git-commit.sh b/git-commit.sh
index f28fc24..5b560f9 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -557,7 +557,7 @@ then
 	} >>"$GIT_DIR"/COMMIT_EDITMSG
 else
 	# we need to check if there is anything to commit
-	run_status >/dev/null
+	run_status >/dev/null
 fi
 if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
 then
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 6ed4719..272a435 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -176,7 +176,7 @@ foreach my $f (@afiles) {
     if (@status > 1) { warn 'Strange! cvs status returned more than
one line?'};
     if (-d dirname $f and $status[0] !~ m/Status: Unknown$/
 	and $status[0] !~ m/^File: no file /) {
- 	$dirty = 1;
+	$dirty = 1;
 	warn "File $f is already known in your CVS checkout -- perhaps it
has been added by another user. Or this may indicate that it exists on
a different branch. If this is the case, use -f to force the
merge.\n";
 	warn "Status was: $status[0]\n";
     }
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index ac74bc5..d41eace 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -145,7 +145,7 @@ my $cvs_tree;
 if ($#ARGV == 0) {
 	$cvs_tree = $ARGV[0];
 } elsif (-f 'CVS/Repository') {
-	open my $f, '<', 'CVS/Repository' or
+	open my $f, '<', 'CVS/Repository' or
 	    die 'Failed to open CVS/Repository';
 	$cvs_tree = <$f>;
 	chomp $cvs_tree;
@@ -434,7 +434,7 @@ sub file {
 	my ($self,$fn,$rev) = @_;
 	my $res;

-	my ($fh, $name) = tempfile('gitcvs.XXXXXX',
+	my ($fh, $name) = tempfile('gitcvs.XXXXXX',
 		    DIR => File::Spec->tmpdir(), UNLINK => 1);

 	$self->_file($fn,$rev) and $res = $self->_line($fh);
@@ -520,8 +520,8 @@ sub is_sha1 {

 sub get_headref ($$) {
     my $name    = shift;
-    my $git_dir = shift;
-
+    my $git_dir = shift;
+
     my $f = "$git_dir/refs/heads/$name";
     if (open(my $fh, $f)) {
 	    chomp(my $r = <$fh>);
@@ -771,7 +771,7 @@ sub commit {
 		$xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY **
 		$xtag =~ tr/_/\./ if ( $opt_u );
 		$xtag =~ s/[\/]/$opt_s/g;
-		
+
 		my $pid = open2($in, $out, 'git-mktag');
 		print $out "object $cid\n".
 		    "type commit\n".
@@ -788,7 +788,7 @@ sub commit {
 		     $? != 0 or $tagobj !~ /^[0123456789abcdef]{40}$/ ) {
 		    die "Cannot create tag object $xtag: $!\n";
 	        }
-		
+

 		open(C,">$git_dir/refs/tags/$xtag")
 			or die "Cannot create tag $xtag: $!\n";
diff --git a/git-fetch.sh b/git-fetch.sh
index 0e05cf1..85145ad 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -167,7 +167,7 @@ fetch_all_at_once () {
   eval "$eval"

     ( : subshell because we muck with IFS
-      IFS=" 	$LF"
+      IFS="	$LF"
       (
 	if test "$remote" = . ; then
 	    git-show-ref $rref || echo failed "$remote"
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index 7d62d79..254d210 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -88,7 +88,7 @@ case "${1:-.}${2:-.}${3:-.}" in
 		# remove lines that are unique to ours.
 		orig=`git-unpack-file $2`
 		sz0=`wc -c <"$orig"`
-		diff -u -La/$orig -Lb/$orig $orig $src2 | git-apply --no-add
+		diff -u -La/$orig -Lb/$orig $orig $src2 | git-apply --no-add
 		sz1=`wc -c <"$orig"`

 		# If we do not have enough common material, it is not
diff --git a/git-p4import.py b/git-p4import.py
index 60a758b..0f3d97b 100644
--- a/git-p4import.py
+++ b/git-p4import.py
@@ -358,4 +358,3 @@ for id in changes:
     if stitch == 1:
         git.clean_directories()
         stitch = 0
-
diff --git a/git-svn.perl b/git-svn.perl
index 3c4f490..bb2d400 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3985,7 +3985,7 @@ diff-index line ($m hash)
 $l_map = {
 	# repository root url
 	'https://svn.musicpd.org' => {
-		# repository path 		# GIT_SVN_ID
+		# repository path		# GIT_SVN_ID
 		'mpd/trunk'		=>	'trunk',
 		'mpd/tags/0.11.5'	=>	'tags/0.11.5',
 	},
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 3af8c7e..f459762 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -542,7 +542,7 @@ sub copy_path($$$$$$$$) {
 	if ($node_kind eq $SVN::Node::dir) {
 		$srcpath =~ s#/*$#/#;
 	}
-	
+
 	my $pid = open my $f,'-|';
 	die $! unless defined $pid;
 	if (!$pid) {
@@ -560,7 +560,7 @@ sub copy_path($$$$$$$$) {
 		} else {
 			$p = $path;
 		}
-		push(@$new,[$mode,$sha1,$p]);	
+		push(@$new,[$mode,$sha1,$p]);
 	}
 	close($f) or
 		print STDERR "$newrev:$newbranch: could not list files in $oldpath
\@ $rev\n";
diff --git a/git-tag.sh b/git-tag.sh
index 4a0a7b6..3f080bf 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -36,7 +36,7 @@ do
 	exit $?
 	;;
     -m)
-    	annotate=1
+	annotate=1
 	shift
 	message="$1"
 	if test "$#" = "0"; then
@@ -62,7 +62,7 @@ do
 	username="$1"
 	;;
     -d)
-    	shift
+	shift
 	had_error=0
 	for tag
 	do
@@ -150,4 +150,3 @@ if [ "$annotate" ]; then
 fi

 git update-ref "refs/tags/$name" "$object" "$prev"
-
diff --git a/git-verify-tag.sh b/git-verify-tag.sh
index 8db7dd0..f2d5597 100755
--- a/git-verify-tag.sh
+++ b/git-verify-tag.sh
@@ -42,4 +42,3 @@ cat "$GIT_DIR/.tmp-vtag" |
 sed '/-----BEGIN PGP/Q' |
 gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1
 rm -f "$GIT_DIR/.tmp-vtag"
-
diff --git a/gitk b/gitk
index a57e84c..87c3690 100755
--- a/gitk
+++ b/gitk
@@ -337,7 +337,7 @@ proc readrefs {} {
 		    set tagids($name) $commit
 		    lappend idtags($commit) $name
 		}
-	    }		
+	    }
 	    catch {
 	        set tagcontents($name) [exec git cat-file tag $id]
 	    }
-- 
1.5.2.rc3

^ permalink raw reply related

* [PATCH] tiny fix in documentation of git-clone
From: Steffen Prohaska @ 2007-05-12 11:32 UTC (permalink / raw)
  To: git

path in example was missing '../'

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
  Documentation/git-clone.txt |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 6d32c49..644bf12 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -132,7 +132,7 @@ Make a local clone that borrows from the current  
directory, without checking thi
  +
  ------------
  $ git clone -l -s -n . ../copy
-$ cd copy
+$ cd ../copy
  $ git show-branch
  ------------

-- 
1.5.1.2

^ permalink raw reply related

* Re: Merging commits together into a super-commit
From: Yann Dirson @ 2007-05-12 11:34 UTC (permalink / raw)
  To: Carl Worth
  Cc: Petr Baudis, J. Bruce Fields, Linus Torvalds, Johannes Sixt, git
In-Reply-To: <87tzuk31fu.wl%cworth@cworth.org>

On Thu, May 10, 2007 at 12:48:05PM -0700, Carl Worth wrote:
> On Thu, 10 May 2007 21:21:06 +0200, Petr Baudis wrote:
> > I think you are underestimating stg here.
> 
> Yes, maybe I didn't learn to use it well enough.
> 
> > You can stg init just once per branch (ever), I think.
> 
> I don't have details now, but I know I ran into some difficulty when
> leaving the extra stg state around.

I really think we should have a "stg uninit" command.  Note that
currently "stg branch --delete" on master will just do that instead of
really deleting the branch, but that is a known bug (#8732 on gna).

> It seems that it added stuff that
> resulted in some reference of mine becoming ambiguous, ("refspec <foo>
> matches more than one" perhaps?). What I do remember is that I couldn't
> get one of my standard git push commands to work until I deleted all
> of .git/refs/bases and .git/refs/patches and then things started to
> work again.

I remember quite some time ago that cg-push exhibited this behaviour.
However, nowadays I frequently push stgit stacks with git-push without
a problem.

> > 	stg uncommit -n N
> > 	stg pop -n N-1
> > 	..hack..
> > 	stg refresh
> > 	stg push -a
> >
> > It seems to be a bit shorter than the sequence you've presented above,
> > and overally working with volatile commits using StGIT feels much more
> > natural to me - and I haven't even ever used quilt seriously! (I have
> > special antipathy to the git reset UI, too.)
> 
> The -n option is something I hadn't noticed, and that helps, (except
> that what I've got to start with is a git revision name, not a
> number).

While "uncommit to named commit" that Karl implemented helps here, and
that "stg goto <patchname>" may be a viable alternative to "pop -n",
you may also want to try:

	stg uncommit -t <commit>
	..hack..
	stg refresh -p <patchname>

There are still some rough edges with "refresh -p", though[*], but
when it works I love this comfort :)

Best regards,
-- 
Yann.

[*] most notably, it does not work yet if any patch above the one you
want to modify changes the same file)

^ permalink raw reply

* [PATCH] Document patch syntax.
From: Yann Dirson @ 2007-05-12 12:07 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git




Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 Documentation/stg.txt |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/Documentation/stg.txt b/Documentation/stg.txt
index af57c37..3ea51c3 100644
--- a/Documentation/stg.txt
+++ b/Documentation/stg.txt
@@ -51,6 +51,31 @@ Development branch::
 In such a setup, not all commits on your branch need to be StGIT
 patches; there may be regular GIT commits below your stack base.
 
+Patches
+~~~~~~~
+
+Many StGIT commands take references to StGIT patches as arguments.
+Patches in the stack are identified with a short name, which must be
+unique in the stack.
+
+Patches in the current stack are just refered to by their name.  Some
+commands allow to specify a patch in another stack of the repository;
+this is done by suffixing the patch name with a '@' sign followed by the
+branch name (eg. 'thispatch@otherbranch').
+
+A number of position in the stack related to the patch are also
+accessible through '//' suffixes.  For example, 'patch//top'' is
+equivalent to 'patch', and 'patch//bottom' refers to the commit below
+'patch' (ie. the patch below, or the stack base if this is the
+bottom-most patch).  Similarly ''//top.old'' and ''//bottom.old''
+refer to the previous version of the patch (before the last
+stglink:push[] or stglink:refresh[] operation).  When refering to the
+current patch, its name can be omitted (eg. 'currentpatch//bottom.old'
+can be abbreviated as 'bottom.old').
+
+If you need to pass a given StGIT reference to a git command,
+stglink:id[] will convert it to a git commit id.
+
 OPTIONS
 -------
 

^ permalink raw reply related

* Re: Merging commits together into a super-commit
From: Jan Hudec @ 2007-05-12 13:02 UTC (permalink / raw)
  To: Eugine Kosenko; +Cc: git
In-Reply-To: <9909dee80705110541m13c4035tc8338e179d6bec9b@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

On Fri, May 11, 2007 at 15:41:45 +0300, Eugine Kosenko wrote:
> 2007/5/11, Alex Riesen <raa.lkml@gmail.com>:
> >And it is not enough. Authorship information is lost.
> 
> If one dare to make such super-commit, he would be the author of the
> whole couple of changes.

No, he would not. He would be committer, but the change would still be based
on the work of the original authors and therefore would have to be attributed
to them (and especially they would still remain copyright holders).

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: kernel cherry UN-picking?
From: Jan Harkes @ 2007-05-12 13:39 UTC (permalink / raw)
  To: Git Mailing List
In-Reply-To: <7vbqgr9fn9.fsf@assigned-by-dhcp.cox.net>

On Fri, May 11, 2007 at 03:09:14PM -0700, Junio C Hamano wrote:
> Suppose you have something like this (you may have more than one
> such merge but the principle is the same):
> 
>   U---o---o---o---M---x---o---o---o---T
>                  /
>    Linville o---o
> 
> Up to 'U' you have already sent upstream and no need for
> resending.  'M' is merge with Linville tree.  'x' is the bad
> one, and 'o' are good ones.  'T' is the tip of your net driver
> branch.

There are even more ways to fix this up, they both start with
identifying the commit 'y' that was committed after 'x',

    git rebase --onto x^ y T

The other solution is to use .git/info/grafts,

    Add a line with the sha1 of 'y' with the parents of 'x'. You can
    visually inspect with gitk if it looks right and then use a script
    that rewrites the history. Either cg-admin-rewrite or the one I
    posted to the list a while ago.

The history rewriting solution will work even if 'x' was introduced
before the merge commit.

Jan

^ permalink raw reply

* Re: Merging commits together into a super-commit
From: Jakub Narebski @ 2007-05-12 13:59 UTC (permalink / raw)
  To: git
In-Reply-To: <20070512113430.GL19253@nan92-1-81-57-214-146.fbx.proxad.net>

Yann Dirson wrote:

> On Thu, May 10, 2007 at 12:48:05PM -0700, Carl Worth wrote:
>> On Thu, 10 May 2007 21:21:06 +0200, Petr Baudis wrote:
>> > I think you are underestimating stg here.
>> 
>> Yes, maybe I didn't learn to use it well enough.
>> 
>> > You can stg init just once per branch (ever), I think.
>> 
>> I don't have details now, but I know I ran into some difficulty when
>> leaving the extra stg state around.
> 
> I really think we should have a "stg uninit" command.  Note that
> currently "stg branch --delete" on master will just do that instead of
> really deleting the branch, but that is a known bug (#8732 on gna).

It would be also nice to have command to remove applied patches.
Sometimes I'd muck up StGIT stack by rebasing in git. Applied patches
are in repository, but I'm interested in preserving unapplied ones.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH] Document patch syntax.
From: Karl Hasselström @ 2007-05-12 13:56 UTC (permalink / raw)
  To: Yann Dirson; +Cc: Catalin Marinas, git
In-Reply-To: <20070512120704.22970.45140.stgit@gandelf.nowhere.earth>

On 2007-05-12 14:07:04 +0200, Yann Dirson wrote:

> +Patches in the stack are identified with a short name, which must be
> +unique in the stack.

s/a short name/short names/, maybe.

> +Patches in the current stack are just refered to by their name.  Some
> +commands allow to specify a patch in another stack of the repository;

s/allow to/allow you to/. Or "allows one to", but I prefer the second
person here.

> +this is done by suffixing the patch name with a '@' sign followed by the
> +branch name (eg. 'thispatch@otherbranch').

s/a '@'/an '@'/; "'@'" begins with a vowel sound. :-)

> +A number of position in the stack related to the patch are also

s/position/positions/.

> +accessible through '//' suffixes.  For example, 'patch//top'' is
> +equivalent to 'patch', and 'patch//bottom' refers to the commit below
> +'patch' (ie. the patch below, or the stack base if this is the

s/ie./i.e./.

> +bottom-most patch).  Similarly ''//top.old'' and ''//bottom.old''

You use double quotes here, and single quotes above. What's the
distinction?

> +refer to the previous version of the patch (before the last
> +stglink:push[] or stglink:refresh[] operation).  When refering to the

s/refering/referring/.

Otherwise,

Acked-by: Karl Hasselström <kha@treskal.com>

Yes, I'm too picky.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply

* Re: kernel cherry UN-picking?
From: Jan Harkes @ 2007-05-12 14:01 UTC (permalink / raw)
  To: Git Mailing List
In-Reply-To: <20070512133951.GE12121@delft.aura.cs.cmu.edu>

On Sat, May 12, 2007 at 09:39:51AM -0400, Jan Harkes wrote:
> On Fri, May 11, 2007 at 03:09:14PM -0700, Junio C Hamano wrote:
> > Suppose you have something like this (you may have more than one
> > such merge but the principle is the same):
> > 
> >   U---o---o---o---M---x---o---o---o---T
> >                  /
> >    Linville o---o
> > 
> > Up to 'U' you have already sent upstream and no need for
> > resending.  'M' is merge with Linville tree.  'x' is the bad
> > one, and 'o' are good ones.  'T' is the tip of your net driver
> > branch.
> 
> There are even more ways to fix this up, they both start with
> identifying the commit 'y' that was committed after 'x',
> 
>     git rebase --onto x^ y T
> 
> The other solution is to use .git/info/grafts,
> 
>     Add a line with the sha1 of 'y' with the parents of 'x'. You can
>     visually inspect with gitk if it looks right and then use a script
>     that rewrites the history. Either cg-admin-rewrite or the one I
>     posted to the list a while ago.
> 
> The history rewriting solution will work even if 'x' was introduced
> before the merge commit.

My brain must be fried. history rewriting is not a good solution here.
Although it removes the commit message, it would leave the bad change
around because it leaves the actual trees intact.

Jan

^ permalink raw reply

* Re: Merging commits together into a super-commit
From: Karl Hasselström @ 2007-05-12 14:02 UTC (permalink / raw)
  To: Yann Dirson
  Cc: Carl Worth, Petr Baudis, J. Bruce Fields, Linus Torvalds,
	Johannes Sixt, git
In-Reply-To: <20070512113430.GL19253@nan92-1-81-57-214-146.fbx.proxad.net>

On 2007-05-12 13:34:30 +0200, Yann Dirson wrote:

> I really think we should have a "stg uninit" command. Note that
> currently "stg branch --delete" on master will just do that instead
> of really deleting the branch, but that is a known bug (#8732 on
> gna).

What we should do is delete all stgit metadata when the last patch
goes away.

And we shouldn't have "stg init", either. Initing should be done
automatically when needed.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply

* Re: GIT on MinGW problem
From: Aaron Gray @ 2007-05-12 14:20 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Han-Wen Nienhuys

>This should be fixed in
>
>http://lilypond.org/git/binaries/mingw/git-1.5.1-2.mingw.exe

Great.

I could not get commands like git-clone to work from CMD although this is 
not really a handycap for the time being.

On doing a clone I get the message :-

        warning: templates not found /usr/share/git-core/templates/

Aaron 

^ permalink raw reply

* Re: [PATCH] Document patch syntax.
From: Yann Dirson @ 2007-05-12 14:38 UTC (permalink / raw)
  To: Karl Hasselström; +Cc: Catalin Marinas, git
In-Reply-To: <20070512135644.GA28039@diana.vm.bytemark.co.uk>

On Sat, May 12, 2007 at 03:56:44PM +0200, Karl Hasselström wrote:
> On 2007-05-12 14:07:04 +0200, Yann Dirson wrote:
> 
> > +Patches in the stack are identified with a short name, which must be
> > +unique in the stack.
> 
> s/a short name/short names/, maybe.

Hm, not sure how that would play with the end of the sentence - any
native english speaker with an opinion ?


> > +Patches in the current stack are just refered to by their name.  Some
> > +commands allow to specify a patch in another stack of the repository;
> 
> s/allow to/allow you to/. Or "allows one to", but I prefer the second
> person here.

No strong opinion here.  However, that makes me think we should
probably use guideline for the docs - here comes the question of which
convention to use when refering to the user.  Do we address her
directly ("you"), indirectly ("the user", "her" - don't remember where
the "female user" use comes from, but we could maybe follow this),
even more indirectly ("one"), or any other way ?


> s/a '@'/an '@'/; "'@'" begins with a vowel sound. :-)
> s/position/positions/.
> s/ie./i.e./.
> s/refering/referring/.

OK

> > +bottom-most patch).  Similarly ''//top.old'' and ''//bottom.old''
> 
> You use double quotes here, and single quotes above. What's the
> distinction?

Er... is "typo" a distinction ? :)
Confusion induced by wiki markups, probably :(


> Yes, I'm too picky.

Not a problem, I tend to be quite picky too :)

Best regards,
-- 
Yann.

^ permalink raw reply

* Re: Merging commits together into a super-commit
From: Yann Dirson @ 2007-05-12 14:41 UTC (permalink / raw)
  To: Carl Worth, Petr Baudis, J. Bruce Fields, Linus Torvalds,
	Johannes Sixt, git
In-Reply-To: <20070512140228.GB28039@diana.vm.bytemark.co.uk>

On Sat, May 12, 2007 at 04:02:28PM +0200, Karl Hasselström wrote:
> On 2007-05-12 13:34:30 +0200, Yann Dirson wrote:
> 
> > I really think we should have a "stg uninit" command. Note that
> > currently "stg branch --delete" on master will just do that instead
> > of really deleting the branch, but that is a known bug (#8732 on
> > gna).
> 
> What we should do is delete all stgit metadata when the last patch
> goes away.

This supposes there is no valuable branch-level metadata.  Currently
we have the description - something which could arguably be moved to
the git level as well.  Otherwise that sounds reasonable to me.

> And we shouldn't have "stg init", either. Initing should be done
> automatically when needed.

Good idea as well, that would make stg more accessible to the average
plain-git user.

Best regards,
-- 
Yann.

^ permalink raw reply

* Win32 version, was Re: quick bare clones taking longer?
From: Johannes Schindelin @ 2007-05-12 15:25 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Git Mailing List
In-Reply-To: <2FFB6305-AB01-4C78-9831-18522C0FFE79@silverinsanity.com>

Hi,

On Thu, 10 May 2007, Brian Gernhardt wrote:

> Someday Git may work on Windows without a funny (for MS) environment.  
> But that day is not today.  Tomorrow doesn't look too good either.  ;-)

It sure sounds like you would like that day rather sooner than later. In 
related news, that day will be sooner rather than later, if people who 
actually care deeply about this _do_ something about it.

Hth,
Dscho

^ permalink raw reply

* [RFC] format-patch stuff
From: Daniel Barkalow @ 2007-05-12 15:36 UTC (permalink / raw)
  To: git

It would be nice if git-format-patch would generate a [PATCH 0/n] message 
at the start of the series if some option were given. This would, of 
course, have to be editted afterwards to include actual information, but 
it would at least be pre-generated in series and with the configured 
headers and such.

Shouldn't the format.headers configuration automatically apply the correct 
line termination? Currently, you need to know to put in \r\n at the end of 
each one, and the example isn't even right (only puts \n).

Once we've got library support for remotes configuration, it would be nice 
to be able to have "mailto:" remotes with emailed patch configuration 
stuff per-destination.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply

* Re: [PATCH] t5000: skip ZIP tets when unzip is absent
From: Johannes Schindelin @ 2007-05-12 15:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vps58ieuw.fsf@assigned-by-dhcp.cox.net>

Hi,

On Thu, 10 May 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> >
> > ---
> >
> >  t/t5000-tar-tree.sh |    7 +++++++
> >  1 files changed, 7 insertions(+), 0 deletions(-)
> >
> > diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
> > index e223c07..1580592 100755
> > --- a/t/t5000-tar-tree.sh
> > +++ b/t/t5000-tar-tree.sh
> > @@ -108,6 +108,13 @@ test_expect_success \
> >      'git-archive --format=zip' \
> >      'git-archive --format=zip HEAD >d.zip'
> >  
> > +unzip -v 2>/dev/null
> > +if [ $? -ne 10 ]; then
> > +	echo "Skipping ZIP tests, because unzip was not found"
> > +	test_done
> > +	exit
> > +fi
> > +
> 
> Are you sure about this?

No longer.

At least one unzip version I tested returned exit code 10 when correctly 
showing the usage (IIRC). However, another one has exit code 0!

Also, it should not hardcode "unzip", but instead use "$UNZIP".

So, please ignore this patch. I try to do it properly.

Ciao,
Dscho

^ permalink raw reply

* [PATCH 0/3] Remotes library, take 4
From: Daniel Barkalow @ 2007-05-12 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Updated for recent review. If remote section name starts with '/', it is 
ignored (like in 1.5.0). If a remote section option has no value, it is 
also ignored (so it doesn't crash, and to be forward-compatible if we 
introduce a boolean option later).

The struct refspec field and associated variables are spelled "dst".

Part 3 is unchanged.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply

* [PATCH 1/3] Move remote parsing into a library file out of builtin-push.
From: Daniel Barkalow @ 2007-05-12 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The new parser is different from the one in builtin-push in two ways:
the default is to use the current branch's remote, if there is one,
before "origin"; and config is used in preference to remotes.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 Makefile       |    5 +-
 builtin-push.c |  190 ++++++----------------------------------------------
 remote.c       |  204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 remote.h       |   18 +++++
 4 files changed, 245 insertions(+), 172 deletions(-)
 create mode 100644 remote.c
 create mode 100644 remote.h

diff --git a/Makefile b/Makefile
index 7cf146b..134fbd2 100644
--- a/Makefile
+++ b/Makefile
@@ -296,7 +296,8 @@ LIB_H = \
 	diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
 	run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
 	tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
-	utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h mailmap.h
+	utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \
+	mailmap.h remote.h
 
 DIFF_OBJS = \
 	diff.o diff-lib.o diffcore-break.o diffcore-order.o \
@@ -318,7 +319,7 @@ LIB_OBJS = \
 	write_or_die.o trace.o list-objects.o grep.o match-trees.o \
 	alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \
 	color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \
-	convert.o attr.o decorate.o progress.o mailmap.o
+	convert.o attr.o decorate.o progress.o mailmap.o remote.o
 
 BUILTIN_OBJS = \
 	builtin-add.o \
diff --git a/builtin-push.c b/builtin-push.c
index cb78401..0e602f3 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -5,17 +5,13 @@
 #include "refs.h"
 #include "run-command.h"
 #include "builtin.h"
-
-#define MAX_URI (16)
+#include "remote.h"
 
 static const char push_usage[] = "git-push [--all] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
 
 static int all, tags, force, thin = 1, verbose;
 static const char *receivepack;
 
-#define BUF_SIZE (2084)
-static char buffer[BUF_SIZE];
-
 static const char **refspec;
 static int refspec_nr;
 
@@ -137,175 +133,29 @@ static void set_refspecs(const char **refs, int nr)
 	expand_refspecs();
 }
 
-static int get_remotes_uri(const char *repo, const char *uri[MAX_URI])
-{
-	int n = 0;
-	FILE *f = fopen(git_path("remotes/%s", repo), "r");
-	int has_explicit_refspec = refspec_nr || all || tags;
-
-	if (!f)
-		return -1;
-	while (fgets(buffer, BUF_SIZE, f)) {
-		int is_refspec;
-		char *s, *p;
-
-		if (!prefixcmp(buffer, "URL:")) {
-			is_refspec = 0;
-			s = buffer + 4;
-		} else if (!prefixcmp(buffer, "Push:")) {
-			is_refspec = 1;
-			s = buffer + 5;
-		} else
-			continue;
-
-		/* Remove whitespace at the head.. */
-		while (isspace(*s))
-			s++;
-		if (!*s)
-			continue;
-
-		/* ..and at the end */
-		p = s + strlen(s);
-		while (isspace(p[-1]))
-			*--p = 0;
-
-		if (!is_refspec) {
-			if (n < MAX_URI)
-				uri[n++] = xstrdup(s);
-			else
-				error("more than %d URL's specified, ignoring the rest", MAX_URI);
-		}
-		else if (is_refspec && !has_explicit_refspec) {
-			if (!wildcard_ref(s))
-				add_refspec(xstrdup(s));
-		}
-	}
-	fclose(f);
-	if (!n)
-		die("remote '%s' has no URL", repo);
-	return n;
-}
-
-static const char **config_uri;
-static const char *config_repo;
-static int config_repo_len;
-static int config_current_uri;
-static int config_get_refspecs;
-static int config_get_receivepack;
-
-static int get_remote_config(const char* key, const char* value)
-{
-	if (!prefixcmp(key, "remote.") &&
-	    !strncmp(key + 7, config_repo, config_repo_len)) {
-		if (!strcmp(key + 7 + config_repo_len, ".url")) {
-			if (config_current_uri < MAX_URI)
-				config_uri[config_current_uri++] = xstrdup(value);
-			else
-				error("more than %d URL's specified, ignoring the rest", MAX_URI);
-		}
-		else if (config_get_refspecs &&
-			 !strcmp(key + 7 + config_repo_len, ".push")) {
-			if (!wildcard_ref(value))
-				add_refspec(xstrdup(value));
-		}
-		else if (config_get_receivepack &&
-			 !strcmp(key + 7 + config_repo_len, ".receivepack")) {
-			if (!receivepack) {
-				char *rp = xmalloc(strlen(value) + 16);
-				sprintf(rp, "--receive-pack=%s", value);
-				receivepack = rp;
-			} else
-				error("more than one receivepack given, using the first");
-		}
-	}
-	return 0;
-}
-
-static int get_config_remotes_uri(const char *repo, const char *uri[MAX_URI])
-{
-	config_repo_len = strlen(repo);
-	config_repo = repo;
-	config_current_uri = 0;
-	config_uri = uri;
-	config_get_refspecs = !(refspec_nr || all || tags);
-	config_get_receivepack = (receivepack == NULL);
-
-	git_config(get_remote_config);
-	return config_current_uri;
-}
-
-static int get_branches_uri(const char *repo, const char *uri[MAX_URI])
-{
-	const char *slash = strchr(repo, '/');
-	int n = slash ? slash - repo : 1000;
-	FILE *f = fopen(git_path("branches/%.*s", n, repo), "r");
-	char *s, *p;
-	int len;
-
-	if (!f)
-		return 0;
-	s = fgets(buffer, BUF_SIZE, f);
-	fclose(f);
-	if (!s)
-		return 0;
-	while (isspace(*s))
-		s++;
-	if (!*s)
-		return 0;
-	p = s + strlen(s);
-	while (isspace(p[-1]))
-		*--p = 0;
-	len = p - s;
-	if (slash)
-		len += strlen(slash);
-	p = xmalloc(len + 1);
-	strcpy(p, s);
-	if (slash)
-		strcat(p, slash);
-	uri[0] = p;
-	return 1;
-}
-
-/*
- * Read remotes and branches file, fill the push target URI
- * list.  If there is no command line refspecs, read Push: lines
- * to set up the *refspec list as well.
- * return the number of push target URIs
- */
-static int read_config(const char *repo, const char *uri[MAX_URI])
-{
-	int n;
-
-	if (*repo != '/') {
-		n = get_remotes_uri(repo, uri);
-		if (n > 0)
-			return n;
-
-		n = get_config_remotes_uri(repo, uri);
-		if (n > 0)
-			return n;
-
-		n = get_branches_uri(repo, uri);
-		if (n > 0)
-			return n;
-	}
-
-	uri[0] = repo;
-	return 1;
-}
-
 static int do_push(const char *repo)
 {
-	const char *uri[MAX_URI];
-	int i, n, errs;
+	int i, errs;
 	int common_argc;
 	const char **argv;
 	int argc;
+	struct remote *remote = remote_get(repo);
 
-	n = read_config(repo, uri);
-	if (n <= 0)
+	if (!remote)
 		die("bad repository '%s'", repo);
 
+	if (remote->receivepack) {
+		char *rp = xmalloc(strlen(remote->receivepack) + 16);
+		sprintf(rp, "--receive-pack=%s", remote->receivepack);
+		receivepack = rp;
+	}
+	if (!refspec && !all && !tags && remote->push_refspec_nr) {
+		for (i = 0; i < remote->push_refspec_nr; i++) {
+			if (!wildcard_ref(remote->push_refspec[i]))
+				add_refspec(remote->push_refspec[i]);
+		}
+	}
+
 	argv = xmalloc((refspec_nr + 10) * sizeof(char *));
 	argv[0] = "dummy-send-pack";
 	argc = 1;
@@ -318,12 +168,12 @@ static int do_push(const char *repo)
 	common_argc = argc;
 
 	errs = 0;
-	for (i = 0; i < n; i++) {
+	for (i = 0; i < remote->uri_nr; i++) {
 		int err;
 		int dest_argc = common_argc;
 		int dest_refspec_nr = refspec_nr;
 		const char **dest_refspec = refspec;
-		const char *dest = uri[i];
+		const char *dest = remote->uri[i];
 		const char *sender = "send-pack";
 		if (!prefixcmp(dest, "http://") ||
 		    !prefixcmp(dest, "https://"))
@@ -341,7 +191,7 @@ static int do_push(const char *repo)
 		if (!err)
 			continue;
 
-		error("failed to push to '%s'", uri[i]);
+		error("failed to push to '%s'", remote->uri[i]);
 		switch (err) {
 		case -ERR_RUN_COMMAND_FORK:
 			error("unable to fork for %s", sender);
@@ -362,7 +212,7 @@ static int do_push(const char *repo)
 int cmd_push(int argc, const char **argv, const char *prefix)
 {
 	int i;
-	const char *repo = "origin";	/* default repository */
+	const char *repo = NULL;	/* default repository */
 
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
diff --git a/remote.c b/remote.c
new file mode 100644
index 0000000..dbcc74e
--- /dev/null
+++ b/remote.c
@@ -0,0 +1,204 @@
+#include "cache.h"
+#include "remote.h"
+#include "refs.h"
+
+static struct remote **remotes;
+static int allocated_remotes;
+
+#define BUF_SIZE (2048)
+static char buffer[BUF_SIZE];
+
+static void add_push_refspec(struct remote *remote, const char *ref)
+{
+	int nr = remote->push_refspec_nr + 1;
+	remote->push_refspec =
+		xrealloc(remote->push_refspec, nr * sizeof(char *));
+	remote->push_refspec[nr-1] = ref;
+	remote->push_refspec_nr = nr;
+}
+
+static void add_uri(struct remote *remote, const char *uri)
+{
+	int nr = remote->uri_nr + 1;
+	remote->uri =
+		xrealloc(remote->uri, nr * sizeof(char *));
+	remote->uri[nr-1] = uri;
+	remote->uri_nr = nr;
+}
+
+static struct remote *make_remote(const char *name, int len)
+{
+	int i, empty = -1;
+
+	for (i = 0; i < allocated_remotes; i++) {
+		if (!remotes[i]) {
+			if (empty < 0)
+				empty = i;
+		} else {
+			if (len ? (!strncmp(name, remotes[i]->name, len) &&
+				   !remotes[i]->name[len]) :
+			    !strcmp(name, remotes[i]->name))
+				return remotes[i];
+		}
+	}
+
+	if (empty < 0) {
+		empty = allocated_remotes;
+		allocated_remotes += allocated_remotes ? allocated_remotes : 1;
+		remotes = xrealloc(remotes,
+				   sizeof(*remotes) * allocated_remotes);
+		memset(remotes + empty, 0,
+		       (allocated_remotes - empty) * sizeof(*remotes));
+	}
+	remotes[empty] = xcalloc(1, sizeof(struct remote));
+	if (len)
+		remotes[empty]->name = xstrndup(name, len);
+	else
+		remotes[empty]->name = xstrdup(name);
+	return remotes[empty];
+}
+
+static void read_remotes_file(struct remote *remote)
+{
+	FILE *f = fopen(git_path("remotes/%s", remote->name), "r");
+
+	if (!f)
+		return;
+	while (fgets(buffer, BUF_SIZE, f)) {
+		int value_list;
+		char *s, *p;
+
+		if (!prefixcmp(buffer, "URL:")) {
+			value_list = 0;
+			s = buffer + 4;
+		} else if (!prefixcmp(buffer, "Push:")) {
+			value_list = 1;
+			s = buffer + 5;
+		} else
+			continue;
+
+		while (isspace(*s))
+			s++;
+		if (!*s)
+			continue;
+
+		p = s + strlen(s);
+		while (isspace(p[-1]))
+			*--p = 0;
+
+		switch (value_list) {
+		case 0:
+			add_uri(remote, xstrdup(s));
+			break;
+		case 1:
+			add_push_refspec(remote, xstrdup(s));
+			break;
+		}
+	}
+	fclose(f);
+}
+
+static void read_branches_file(struct remote *remote)
+{
+	const char *slash = strchr(remote->name, '/');
+	int n = slash ? slash - remote->name : 1000;
+	FILE *f = fopen(git_path("branches/%.*s", n, remote->name), "r");
+	char *s, *p;
+	int len;
+
+	if (!f)
+		return;
+	s = fgets(buffer, BUF_SIZE, f);
+	fclose(f);
+	if (!s)
+		return;
+	while (isspace(*s))
+		s++;
+	if (!*s)
+		return;
+	p = s + strlen(s);
+	while (isspace(p[-1]))
+		*--p = 0;
+	len = p - s;
+	if (slash)
+		len += strlen(slash);
+	p = xmalloc(len + 1);
+	strcpy(p, s);
+	if (slash)
+		strcat(p, slash);
+	add_uri(remote, p);
+}
+
+static char *default_remote_name = NULL;
+static const char *current_branch = NULL;
+static int current_branch_len = 0;
+
+static int handle_config(const char *key, const char *value)
+{
+	const char *name;
+	const char *subkey;
+	struct remote *remote;
+	if (!prefixcmp(key, "branch.") && current_branch &&
+	    !strncmp(key + 7, current_branch, current_branch_len) &&
+	    !strcmp(key + 7 + current_branch_len, ".remote")) {
+		free(default_remote_name);
+		default_remote_name = xstrdup(value);
+	}
+	if (prefixcmp(key,  "remote."))
+		return 0;
+	name = key + 7;
+	subkey = strrchr(name, '.');
+	if (!subkey)
+		return error("Config with no key for remote %s", name);
+	remote = make_remote(name, subkey - name);
+	if (!strcmp(subkey, ".url")) {
+		add_uri(remote, xstrdup(value));
+	} else if (!strcmp(subkey, ".push")) {
+		add_push_refspec(remote, xstrdup(value));
+	} else if (!strcmp(subkey, ".receivepack")) {
+		if (!remote->receivepack)
+			remote->receivepack = xstrdup(value);
+		else
+			error("more than one receivepack given, using the first");
+	}
+	return 0;
+}
+
+static void read_config(void)
+{
+	unsigned char sha1[20];
+	const char *head_ref;
+	int flag;
+	if (default_remote_name) // did this already
+		return;
+	default_remote_name = xstrdup("origin");
+	current_branch = NULL;
+	head_ref = resolve_ref("HEAD", sha1, 0, &flag);
+	if (head_ref && (flag & REF_ISSYMREF) &&
+	    !prefixcmp(head_ref, "refs/heads/")) {
+		current_branch = head_ref + strlen("refs/heads/");
+		current_branch_len = strlen(current_branch);
+	}
+	git_config(handle_config);
+}
+
+struct remote *remote_get(const char *name)
+{
+	struct remote *ret;
+
+	read_config();
+	if (!name)
+		name = default_remote_name;
+	ret = make_remote(name, 0);
+	if (name[0] != '/') {
+		if (!ret->uri)
+			read_remotes_file(ret);
+		if (!ret->uri)
+			read_branches_file(ret);
+	}
+	if (!ret->uri)
+		add_uri(ret, name);
+	if (!ret->uri)
+		return NULL;
+	return ret;
+}
diff --git a/remote.h b/remote.h
new file mode 100644
index 0000000..73747a8
--- /dev/null
+++ b/remote.h
@@ -0,0 +1,18 @@
+#ifndef REMOTE_H
+#define REMOTE_H
+
+struct remote {
+	const char *name;
+
+	const char **uri;
+	int uri_nr;
+
+	const char **push_refspec;
+	int push_refspec_nr;
+
+	const char *receivepack;
+};
+
+struct remote *remote_get(const char *name);
+
+#endif
-- 
1.5.2.rc2.45.g3d9b43-dirty

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox