Git development
 help / color / mirror / Atom feed
* Re: [PATCH] hg-to-git: fix COMMITTER type-o
From: Stelian Pop @ 2010-01-12 11:16 UTC (permalink / raw)
  To: Bart Trojanowski; +Cc: git
In-Reply-To: <1262998479-24269-1-git-send-email-bart@jukie.net>

Hi Bart,

On Fri, Jan 08, 2010 at 07:54:39PM -0500, Bart Trojanowski wrote:

> This script passes the author and committer to git-commit via environment
> variables, but it was missing the seccond T of COMMITTER in a few places.
> 
> Signed-off-by: Bart Trojanowski <bart@jukie.net>

FWIW:
	Acked-by: Stelian Pop <stelian@popies.net>

Thanks!

Stelian.
-- 
Stelian Pop <stelian@popies.net>

^ permalink raw reply

* Re: [PATCH RFC] gitk: display submodule diffs with appropriate encoding
From: Paul Mackerras @ 2010-01-12 11:23 UTC (permalink / raw)
  To: Kirill Smelkov; +Cc: git
In-Reply-To: <1262695494-27975-1-git-send-email-kirr@landau.phys.spbu.ru>

On Tue, Jan 05, 2010 at 03:44:54PM +0300, Kirill Smelkov wrote:

> Previsously, when submodule commits headings contained non-latin-1
> characters, they were displayed incorrectly in gitk, because $line was
> not properly decoded, i.e.

Thanks, applied.

Paul.

^ permalink raw reply

* Re: [RESEND PATCH] french translation of gitk
From: Paul Mackerras @ 2010-01-12 11:21 UTC (permalink / raw)
  To: Emmanuel Trillaud
  Cc: Nicolas Sebrecht, Maximilien Noal, Matthieu Moy, Nicolas Pitre,
	Git Mailing List, Thomas Moulard, Junio C Hamano, Guy Brand
In-Reply-To: <20100108142218.386bf6a2@eleanor>

On Fri, Jan 08, 2010 at 02:22:18PM +0100, Emmanuel Trillaud wrote:

> Hi all, 
> Thank Nicolas for beeing the ambassador this translation :-)
> 
> Le Tue, 29 Dec 2009 23:39:39 +0100,
> Nicolas Sebrecht <nicolas.s.dev@gmx.fr> a écrit :
> 
> > Hi,
> > 
> > I may be wrong but I think this patch wasn't merged and I didn't see any
> > comment on it.
> > 
> > Could you please merge this patch?
> > 
> > 
> > -- >8 --
> > Subject: [PATCH] gitk: french translation
> > From: Emmanuel Trillaud <etrillaud@gmail.com>
> > 
> > Signed-off-by: Emmanuel Trillaud <etrillaud@gmail.com>
> > Signed-off-by: Thomas Moulard <thomas.moulard@gmail.com>
> > Signed-off-by: Guy Brand <gb@unistra.fr>
> > Signed-off-by: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
> > ---
> [snip]
> 
> I got the following errors when trying to 'make' gitk with your latest patch :
> 
> $ LANG=C make
> Generating catalog po/fr.msg
> msgfmt --statistics --tcl po/fr.po -l fr -d po/
> po/fr.po:23:24: invalid multibyte sequence

[etc]

I get those errors too.  Could somebody resend a corrected patch,
please?

Paul.

^ permalink raw reply

* Re: [PATCH resend] gitk: Adjust two equal strings which differed in whitespace
From: Paul Mackerras @ 2010-01-12 11:22 UTC (permalink / raw)
  To: Markus Heidelberg; +Cc: Christian Stimming, git
In-Reply-To: <1263075072-25904-1-git-send-email-markus.heidelberg@web.de>

On Sat, Jan 09, 2010 at 11:11:12PM +0100, Markus Heidelberg wrote:

> There were the two strings "SHA1 ID: " and "SHA1 ID:" as description for
> the SHA1 search textbox. Change it to two equal strings, the space is
> now outside of the translated string.
> 
> Furthermore the German translation wasn't unique, but "SHA1:" resp.
> "SHA1-Hashwert:". The former was displayed after initialisation, the
> latter after changes to the textbox, for example when clearing the text.
> But it was too long to be displayed fully, so use a shorter translation.
> 
> Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>

Thanks, applied.

Paul.

^ permalink raw reply

* Re: gitosis user on Windows
From: Howard Miller @ 2010-01-12 10:45 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git Mailing List
In-Reply-To: <alpine.DEB.2.00.1001121121380.30408@ds9.cixit.se>

> Howard Miller:
>
>> I have been using gitosis for a while with much success. I now have a user
>> on Windows (XP) wanting to access the repositories. I obviously need a key
>>  from him but asking just elicited a blank look.
>
>  From Git Gui, use Help -> Show SSH Key. If that shows up blank, press the
> "Generate Key" button and follow the instructions.

Thanks, but... he's using Tortoise Git (I've just found out). I guess
he's looking for something similar there?

^ permalink raw reply

* Re: [PATCH] lockfile: show absolute filename in unable_to_lock_message.
From: Matthieu Moy @ 2010-01-12 10:20 UTC (permalink / raw)
  To: gitster; +Cc: git
In-Reply-To: <1262876050-345-1-git-send-email-Matthieu.Moy@imag.fr>

Just ping-ing ...

I think the patch makes sense. Junio, can you either queue the patch,
or argue against it? I promise I'll be nice if you chose the second
option ;-).

Thanks,

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> When calling a git command from a subdirectory and a file locking fails,
> the user will get a path relative to the root of the worktree, which is
> invalid from the place where the command is ran. Make it easy for the
> user to know which file it is.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
>> Since these are merely informative, wouldn't it be more suitable to
>> use make_nonrelative_path()?
>
> Sensible, yes.
>
>  lockfile.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lockfile.c b/lockfile.c
> index 6851fa5..b0d74cd 100644
> --- a/lockfile.c
> +++ b/lockfile.c
> @@ -164,9 +164,10 @@ static char *unable_to_lock_message(const char *path, int err)
>  		    "If no other git process is currently running, this probably means a\n"
>  		    "git process crashed in this repository earlier. Make sure no other git\n"
>  		    "process is running and remove the file manually to continue.",
> -		    path, strerror(err));
> +			    make_nonrelative_path(path), strerror(err));
>  	} else
> -		strbuf_addf(&buf, "Unable to create '%s.lock': %s", path, strerror(err));
> +		strbuf_addf(&buf, "Unable to create '%s.lock': %s",
> +			    make_nonrelative_path(path), strerror(err));
>  	return strbuf_detach(&buf, NULL);
>  }
>  
> -- 
> 1.6.6.81.gda96d0

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply

* Re: gitosis user on Windows
From: Peter Krefting @ 2010-01-12 10:22 UTC (permalink / raw)
  To: Howard Miller; +Cc: Git Mailing List
In-Reply-To: <26ae428a1001120142j36619d62xcf3ffee3539a03b7@mail.gmail.com>

Howard Miller:

> I have been using gitosis for a while with much success. I now have a user 
> on Windows (XP) wanting to access the repositories. I obviously need a key
>  from him but asking just elicited a blank look.

  From Git Gui, use Help -> Show SSH Key. If that shows up blank, press the 
"Generate Key" button and follow the instructions.

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply

* [PATCH (resend)] Be more user-friendly when refusing to do something because of conflict.
From: Matthieu Moy @ 2010-01-12  9:54 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

Various commands refuse to run in the presence of conflicts (commit,
merge, pull, cherry-pick/revert). They all used to provide rough, and
inconsistant error messages.

A new variable advice.resolveconflict is introduced, and allows more
verbose messages, pointing the user to the appropriate solution.

For commit, the error message used to look like this:

$ git commit
foo.txt: needs merge
foo.txt: unmerged (c34a92682e0394bc0d6f4d4a67a8e2d32395c169)
foo.txt: unmerged (3afcd75de8de0bb5076942fcb17446be50451030)
foo.txt: unmerged (c9785d77b76dfe4fb038bf927ee518f6ae45ede4)
error: Error building trees

The "need merge" line is given by refresh_cache. We add the IN_PORCELAIN
option to make the output more consistant with the other porcelain
commands, and catch the error in return, to stop with a clean error
message. The next lines were displayed by a call to cache_tree_update(),
which is not reached anymore if we noticed the conflict.

The new output looks like:

U       foo.txt
fatal: 'commit' is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>' as
appropriate to mark resolution and make a commit, or use 'git commit -a'.

Pull is slightly modified to abort immediately if $GIT_DIR/MERGE_HEAD
exists instead of waiting for merge to complain.

The behavior of merge and the test-case are slightly modified to reflect
the usual flow: start with conflicts, fix them, and afterwards get rid of
MERGE_HEAD, with different error messages at each stage.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
No real change since last version, I just rebased it on pu (and
removed a trailing whitespace on the way). Just making sure my patch
isn't lost.

 Documentation/config.txt      |    4 ++++
 advice.c                      |   16 ++++++++++++++++
 advice.h                      |    5 +++++
 builtin-commit.c              |   14 ++++++++++++--
 builtin-merge.c               |   20 +++++++++++++++-----
 builtin-revert.c              |   15 ++++++++++++++-
 git-pull.sh                   |   25 +++++++++++++++++++++++--
 t/t3030-merge-recursive.sh    |    6 ++++--
 t/t3501-revert-cherry-pick.sh |    2 +-
 9 files changed, 94 insertions(+), 13 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 7955174..29ac66f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -130,6 +130,10 @@ advice.*::
 		Advice shown when linkgit:git-merge[1] refuses to
 		merge to avoid overwritting local changes.
 		Default: true.
+	resolveConflict::
+		Advices shown by various commands when conflicts
+		prevent the operation from being performed.
+		Default: true.
 --
 
 core.fileMode::
diff --git a/advice.c b/advice.c
index cb666ac..3309521 100644
--- a/advice.c
+++ b/advice.c
@@ -3,6 +3,7 @@
 int advice_push_nonfastforward = 1;
 int advice_status_hints = 1;
 int advice_commit_before_merge = 1;
+int advice_resolve_conflict = 1;
 
 static struct {
 	const char *name;
@@ -11,6 +12,7 @@ static struct {
 	{ "pushnonfastforward", &advice_push_nonfastforward },
 	{ "statushints", &advice_status_hints },
 	{ "commitbeforemerge", &advice_commit_before_merge },
+	{ "resolveconflict", &advice_resolve_conflict },
 };
 
 int git_default_advice_config(const char *var, const char *value)
@@ -27,3 +29,17 @@ int git_default_advice_config(const char *var, const char *value)
 
 	return 0;
 }
+
+void NORETURN die_resolve_conflict(const char *me)
+{
+	if (advice_resolve_conflict)
+		/*
+		 * Message used both when 'git commit' fails and when
+		 * other commands doing a merge do.
+		 */
+		die("'%s' is not possible because you have unmerged files.\n"
+		    "Please, fix them up in the work tree, and then use 'git add/rm <file>' as\n"
+		    "appropriate to mark resolution and make a commit, or use 'git commit -a'.", me);
+	else
+		die("'%s' is not possible because you have unmerged files.", me);
+}
diff --git a/advice.h b/advice.h
index 3de5000..acd5fdd 100644
--- a/advice.h
+++ b/advice.h
@@ -1,10 +1,15 @@
 #ifndef ADVICE_H
 #define ADVICE_H
 
+#include "git-compat-util.h"
+
 extern int advice_push_nonfastforward;
 extern int advice_status_hints;
 extern int advice_commit_before_merge;
+extern int advice_resolve_conflict;
 
 int git_default_advice_config(const char *var, const char *value);
 
+extern void NORETURN die_resolve_conflict(const char *me);
+
 #endif /* ADVICE_H */
diff --git a/builtin-commit.c b/builtin-commit.c
index 6199db7..a716603 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -245,6 +245,16 @@ static void create_base_index(void)
 		exit(128); /* We've already reported the error, finish dying */
 }
 
+static void refresh_cache_or_die(int refresh_flags)
+{
+	/*
+	 * refresh_flags contains REFRESH_QUIET, so the only errors
+	 * are for unmerged entries.
+	 */
+	if (refresh_cache(refresh_flags | REFRESH_IN_PORCELAIN))
+		die_resolve_conflict("commit");
+}
+
 static char *prepare_index(int argc, const char **argv, const char *prefix, int is_status)
 {
 	int fd;
@@ -284,7 +294,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 	if (all || (also && pathspec && *pathspec)) {
 		int fd = hold_locked_index(&index_lock, 1);
 		add_files_to_cache(also ? prefix : NULL, pathspec, 0);
-		refresh_cache(refresh_flags);
+		refresh_cache_or_die(refresh_flags);
 		if (write_cache(fd, active_cache, active_nr) ||
 		    close_lock_file(&index_lock))
 			die("unable to write new_index file");
@@ -303,7 +313,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 	 */
 	if (!pathspec || !*pathspec) {
 		fd = hold_locked_index(&index_lock, 1);
-		refresh_cache(refresh_flags);
+		refresh_cache_or_die(refresh_flags);
 		if (write_cache(fd, active_cache, active_nr) ||
 		    commit_locked_index(&index_lock))
 			die("unable to write new_index file");
diff --git a/builtin-merge.c b/builtin-merge.c
index 4fe516e..3aaec7b 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -886,11 +886,21 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 	const char *best_strategy = NULL, *wt_strategy = NULL;
 	struct commit_list **remotes = &remoteheads;
 
-	if (file_exists(git_path("MERGE_HEAD")))
-		die("You have not concluded your merge. (MERGE_HEAD exists)");
-	if (read_cache_unmerged())
-		die("You are in the middle of a conflicted merge."
-				" (index unmerged)");
+	if (read_cache_unmerged()) {
+		die_resolve_conflict("merge");
+	}
+	if (file_exists(git_path("MERGE_HEAD"))) {
+		/*
+		 * There is no unmerged entry, don't advise 'git
+		 * add/rm <file>', just 'git commit'.
+		 */
+		if (advice_resolve_conflict)
+			die("You have not concluded your merge (MERGE_HEAD exists).\n"
+			    "Please, commit your changes before you can merge.");
+		else
+			die("You have not concluded your merge (MERGE_HEAD exists).");
+	}
+
 	resolve_undo_clear();
 	/*
 	 * Check if we are _not_ on a detached HEAD, i.e. if there is a
diff --git a/builtin-revert.c b/builtin-revert.c
index 857ca2e..8ac86f0 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -235,6 +235,19 @@ static struct tree *empty_tree(void)
 	return tree;
 }
 
+static NORETURN void die_dirty_index(const char *me)
+{
+	if (read_cache_unmerged()) {
+		die_resolve_conflict(me);
+	} else {
+		if (advice_commit_before_merge)
+			die("Your local changes would be overwritten by %s.\n"
+			    "Please, commit your changes or stash them to proceed.", me);
+		else
+			die("Your local changes would be overwritten by %s.\n", me);
+	}
+}
+
 static int revert_or_cherry_pick(int argc, const char **argv)
 {
 	unsigned char head[20];
@@ -271,7 +284,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 		if (get_sha1("HEAD", head))
 			die ("You do not have a valid HEAD");
 		if (index_differs_from("HEAD", 0))
-			die ("Dirty index: cannot %s", me);
+			die_dirty_index(me);
 	}
 	discard_cache();
 
diff --git a/git-pull.sh b/git-pull.sh
index 8c0905a..754daaa 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -13,8 +13,29 @@ set_reflog_action "pull $*"
 require_work_tree
 cd_to_toplevel
 
-test -z "$(git ls-files -u)" ||
-	die "You are in the middle of a conflicted merge."
+
+die_conflict () {
+    git diff-index --cached --name-status -r --ignore-submodules HEAD --
+    if [ $(git config --bool --get advice.resolveConflict || echo true) = "true" ]; then
+	die "Pull is not possible because you have unmerged files.
+Please, fix them up in the work tree, and then use 'git add/rm <file>'
+as appropriate to mark resolution, or use 'git commit -a'."
+    else
+	die "Pull is not possible because you have unmerged files."
+    fi
+}
+
+die_merge () {
+    if [ $(git config --bool --get advice.resolveConflict || echo true) = "true" ]; then
+	die "You have not concluded your merge (MERGE_HEAD exists).
+Please, commit your changes before you can merge."
+    else
+	die "You have not concluded your merge (MERGE_HEAD exists)."
+    fi
+}
+
+test -z "$(git ls-files -u)" || die_conflict
+test -f "$GIT_DIR/MERGE_HEAD" && die_merge
 
 strategy_args= diffstat= no_commit= squash= no_ff= ff_only=
 log_arg= verbosity=
diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh
index 9b3fa2b..9929f82 100755
--- a/t/t3030-merge-recursive.sh
+++ b/t/t3030-merge-recursive.sh
@@ -276,11 +276,13 @@ test_expect_success 'fail if the index has unresolved entries' '
 
 	test_must_fail git merge "$c5" &&
 	test_must_fail git merge "$c5" 2> out &&
+	grep "not possible because you have unmerged files" out &&
+	git add -u &&
+	test_must_fail git merge "$c5" 2> out &&
 	grep "You have not concluded your merge" out &&
 	rm -f .git/MERGE_HEAD &&
 	test_must_fail git merge "$c5" 2> out &&
-	grep "You are in the middle of a conflicted merge" out
-
+	grep "Your local changes to .* would be overwritten by merge." out
 '
 
 test_expect_success 'merge-recursive remove conflict' '
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index bb4cf00..7f85815 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -66,7 +66,7 @@ test_expect_success 'revert forbidden on dirty working tree' '
 	echo content >extra_file &&
 	git add extra_file &&
 	test_must_fail git revert HEAD 2>errors &&
-	grep "Dirty index" errors
+	grep "Your local changes would be overwritten by " errors
 
 '
 
-- 
1.6.6.198.gbaea2

^ permalink raw reply related

* Re: [PATCH 04/18] date.c: mark file-local function static
From: Johannes Sixt @ 2010-01-12  9:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vr5pv3d7w.fsf@alter.siamese.dyndns.org>

Junio C Hamano schrieb:
> Johannes Sixt <j.sixt@viscovery.net> writes:
>> This one is used from compat/mingw.c for the gettimeofday emulation.
>> Please leave it extern.

I'll add this patch to may windows-update series to avoids this hack.

--- 8< ---
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] compat/mingw.c: do not use tm_to_time_t from date.c

To implement gettimeofday(), a broken-down UTC time was requested from the
system using GetSystemTime() and converted using tm_to_time_t() because it
does not look at the current timezone, which mktime() would do. But
meanwhile we have grown infrastructure in mingw.c, so that we can use a
different conversion path. This way we can avoid the ugly back-reference
from the compatibility layer to the generic git code.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 compat/mingw.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index faaaade..3c78f39 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -281,19 +281,11 @@ int mkstemp(char *template)
 
 int gettimeofday(struct timeval *tv, void *tz)
 {
-	SYSTEMTIME st;
-	struct tm tm;
-	GetSystemTime(&st);
-	tm.tm_year = st.wYear-1900;
-	tm.tm_mon = st.wMonth-1;
-	tm.tm_mday = st.wDay;
-	tm.tm_hour = st.wHour;
-	tm.tm_min = st.wMinute;
-	tm.tm_sec = st.wSecond;
-	tv->tv_sec = tm_to_time_t(&tm);
-	if (tv->tv_sec < 0)
-		return -1;
-	tv->tv_usec = st.wMilliseconds*1000;
+	FILETIME ft;
+	GetSystemTimeAsFileTime(&ft);
+	tv->tv_sec = filetime_to_time_t(&ft);
+	/* the unit is 100-nanoseconds, ie., a 10th of a microsecond */
+	tv->tv_usec = (ft.dwLowDateTime % 10000000) / 10;
 	return 0;
 }
 
-- 
1.6.6.1207.g714a1.dirty

^ permalink raw reply related

* gitosis user on Windows
From: Howard Miller @ 2010-01-12  9:42 UTC (permalink / raw)
  To: git

I have been using gitosis for a while with much success. I now have a
user on Windows (XP) wanting to access the repositories. I obviously
need a key from him but asking just elicited a blank look. I don't
have the slightest idea about Windows. Does anybody have this working
and can provide any advice. I did do a search but it seems highly
inconclusive.

Thanks!!

^ permalink raw reply

* Re: [PATCH 04/18] date.c: mark file-local function static
From: Junio C Hamano @ 2010-01-12  9:05 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git
In-Reply-To: <4B4C34B3.3010508@viscovery.net>

Johannes Sixt <j.sixt@viscovery.net> writes:

>> diff --git a/git-compat-util.h b/git-compat-util.h
>> index 5c59687..85dea12 100644
>> --- a/git-compat-util.h
>> +++ b/git-compat-util.h
>> @@ -198,7 +198,6 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
>>  extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
>>  
>>  extern int prefixcmp(const char *str, const char *prefix);
>> -extern time_t tm_to_time_t(const struct tm *tm);
>>  
>>  static inline const char *skip_prefix(const char *str, const char *prefix)
>>  {
>
> This one is used from compat/mingw.c for the gettimeofday emulation.
> Please leave it extern.

Ouch; I thought I ran "git grep <sym> pu" for all of them.
Sorry and thanks.

^ permalink raw reply

* Re: [PATCH 04/18] date.c: mark file-local function static
From: Johannes Sixt @ 2010-01-12  8:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <1263282781-25596-5-git-send-email-gitster@pobox.com>

Junio C Hamano schrieb:
> diff --git a/date.c b/date.c
> index 5d05ef6..45f3684 100644
> --- a/date.c
> +++ b/date.c
> @@ -9,7 +9,7 @@
>  /*
>   * This is like mktime, but without normalization of tm_wday and tm_yday.
>   */
> -time_t tm_to_time_t(const struct tm *tm)
> +static time_t tm_to_time_t(const struct tm *tm)
>  {
>  	static const int mdays[] = {
>  	    0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 5c59687..85dea12 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -198,7 +198,6 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
>  extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
>  
>  extern int prefixcmp(const char *str, const char *prefix);
> -extern time_t tm_to_time_t(const struct tm *tm);
>  
>  static inline const char *skip_prefix(const char *str, const char *prefix)
>  {

This one is used from compat/mingw.c for the gettimeofday emulation.
Please leave it extern.

-- Hannes

^ permalink raw reply

* [PATCH] grep: -L should show empty files
From: Junio C Hamano @ 2010-01-12  8:32 UTC (permalink / raw)
  To: git; +Cc: Linus Torvalds, Miles Bader, Jeff King, Nguyen Thai Ngoc Duy
In-Reply-To: <7v63774tfd.fsf@alter.siamese.dyndns.org>

The -L (--files-without-match) option is supposed to show paths that
produced no matches.  When running the internal grep on work tree files,
however, we had an optimization to just return on zero-sized files,
without doing anything.

This optimization doesn't matter too much in practice (a tracked empty
file must be rare, or there is something wrong with your project); to
produce results consistent with GNU grep, we should stop the optimization
and show empty files as not having the given pattern.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Fix for a longstanding bug meant for maint.

 builtin-grep.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/builtin-grep.c b/builtin-grep.c
index fd450bc..84a5af3 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -159,8 +159,6 @@ static int grep_file(struct grep_opt *opt, const char *filename)
 			error("'%s': %s", filename, strerror(errno));
 		return 0;
 	}
-	if (!st.st_size)
-		return 0; /* empty file -- no grep hit */
 	if (!S_ISREG(st.st_mode))
 		return 0;
 	sz = xsize_t(st.st_size);
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH] grep: lookahead optimization can be used with -L option
From: Junio C Hamano @ 2010-01-12  8:31 UTC (permalink / raw)
  To: git; +Cc: Linus Torvalds, Miles Bader, Jeff King, Nguyen Thai Ngoc Duy
In-Reply-To: <7v63774tfd.fsf@alter.siamese.dyndns.org>

This is not an "inverted logic" option ("-v") that shows lines
that do not match given pattern as hits, and skipping lines that
cannot possibly match wouldn't change its outcome.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Should be squashed in to the "lookahead" patch.

 grep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/grep.c b/grep.c
index 048b982..03ffcd4 100644
--- a/grep.c
+++ b/grep.c
@@ -614,7 +614,7 @@ static int should_lookahead(struct grep_opt *opt)
 
 	if (opt->extended)
 		return 0; /* punt for too complex stuff */
-	if (opt->invert || opt->unmatch_name_only)
+	if (opt->invert)
 		return 0;
 	for (p = opt->pattern_list; p; p = p->next) {
 		if (p->token != GREP_PATTERN)
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* Re: [PATCH] grep: do not do external grep on skip-worktree entries
From: Junio C Hamano @ 2010-01-12  8:29 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Junio C Hamano, Miles Bader, Jeff King, Nguyen Thai Ngoc Duy, git
In-Reply-To: <alpine.LFD.2.00.1001110830070.13040@localhost.localdomain>

Linus Torvalds <torvalds@linux-foundation.org> writes:

> Ack. Works for me. And with that, I'd love for it to go in, and get rid of 
> the external grep. Performance is now a non-issue (it goes both ways), and 
> the internal grep doesn't have the bug with separators between multi-line 
> greps.
>
> And dropping the external one gets rid of all the issues with PATHs, crap 
> 'grep' implementations, and removes actual code. Goodie.
>
> 		Linus

Before going forward, I found two small nits that should go to maint.

^ permalink raw reply

* [PATCH 01/18] bisect.c: mark file-local function static
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 bisect.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bisect.c b/bisect.c
index f1a1f84..5c03398 100644
--- a/bisect.c
+++ b/bisect.c
@@ -593,7 +593,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
  * is increased by one between each call, but that should not matter
  * for this application.
  */
-int get_prn(int count) {
+static int get_prn(int count) {
 	count = count * 1103515245 + 12345;
 	return ((unsigned)(count/65536) % PRN_MODULO);
 }
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 00/18] mark file-local symbols static
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git
  Cc: Kjetil Barvik, Marius Storm-Olsen, Daniel Barkalow, Thiago Farina,
	Nicolas Pitre, Johannes Schindelin

The early part of the series up to [PATCH 12/18] are uncontroversial; they
all change "extern" symbols that are not used outside of the file they are
defined in to "static".

The remainder remove functions that are not called from anywhere.  While
the result of applying these patches still compiles, I find removal of
some are iffy:

 * map_email(), has_pack_file() and strbuf_tolower() are not even
   documented.  They should go.  It is trivial to reimplement them when a
   new caller needs it.

 * Even though parse_blob() in blob.c is never called, it is part of the
   "object layer" suite that consistently defines their initializers as
   parse_$type().  But it has never been called by anybody since its
   inception at a510bfa (Mark blobs as parsed when they're actually
   parsed, 2005-04-28).

   By the way, Documentation/technical/api-object-access.txt needs some
   love.

 * object_list_append() and object_list_length() in object.c do not have
   any callers, and they are implementations of rather inefficient API.
   Perhaps they should go.

 * I am a bit worried about nobody calling invalidate_lstat_cache() and
   clear_lstat_cache().  Kjetil introduced them in aeabab5 (lstat_cache():
   introduce invalidate_lstat_cache() function, 2009-01-18) and bda6eb0
   (lstat_cache(): introduce clear_lstat_cache() function, 2009-01-18)
   respectively but as far as I can tell there wasn't any user of these
   functions, ever.  They may be broken and nobody knew they were as
   nothing calls them, but more importantly it could be that some existing
   codepaths aren't calling them when they should.

In this series, I am not removing alloc_report(), print_string_list(), and
unsorted_string_list_has_string().  Among these three, the first two are
clearly for debugging and the latter two are documented interfaces, even
though nobody uses them.

I've made sure that they apply to 'master', 'next' and 'pu' (application
to 'pu' has two conflicts that are trivial in 04/18 and 08/18) and the
result compiles.

Junio C Hamano (18):
  bisect.c: mark file-local function static
  builtin-rev-list.c: mark file-local function static
  pretty.c: mark file-local function static
  date.c: mark file-local function static
  http.c: mark file-local functions static
  entry.c: mark file-local function static
  parse-options.c: mark file-local function static
  read-cache.c: mark file-local functions static
  remote-curl.c: mark file-local function static
  quote.c: mark file-local function static
  submodule.c: mark file-local function static
  utf8.c: mark file-local function static
  mailmap.c: remove unused function
  sha1_file.c: remove unused function
  strbuf.c: remove unused function
  blob.c: remove unused function
  object.c: remove unused functions
  symlinks.c: remove unused functions

 bisect.c           |    2 +-
 bisect.h           |    2 --
 blob.c             |   21 ---------------------
 blob.h             |    2 --
 builtin-rev-list.c |    2 +-
 cache.h            |    8 --------
 commit.h           |    1 -
 date.c             |    2 +-
 entry.c            |    2 +-
 git-compat-util.h  |    1 -
 http.c             |   10 ++++++++--
 http.h             |    9 ---------
 mailmap.c          |    5 -----
 mailmap.h          |    1 -
 object.c           |   21 ---------------------
 object.h           |    5 -----
 parse-options.c    |    7 +++++--
 parse-options.h    |    3 ---
 pretty.c           |    2 +-
 quote.c            |    2 +-
 quote.h            |    1 -
 read-cache.c       |    6 ++++--
 remote-curl.c      |    2 +-
 sha1_file.c        |    8 --------
 strbuf.c           |    7 -------
 strbuf.h           |    1 -
 submodule.c        |    2 +-
 symlinks.c         |   31 -------------------------------
 utf8.c             |    2 +-
 utf8.h             |    1 -
 30 files changed, 26 insertions(+), 143 deletions(-)

^ permalink raw reply

* [PATCH 11/18] submodule.c: mark file-local function static
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 submodule.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/submodule.c b/submodule.c
index 86aad65..3007f7d 100644
--- a/submodule.c
+++ b/submodule.c
@@ -5,7 +5,7 @@
 #include "commit.h"
 #include "revision.h"
 
-int add_submodule_odb(const char *path)
+static int add_submodule_odb(const char *path)
 {
 	struct strbuf objects_directory = STRBUF_INIT;
 	struct alternate_object_database *alt_odb;
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 16/18] blob.c: remove unused function
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git; +Cc: Daniel Barkalow
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

parse_blob() is not used anywhere since a510bfa (Mark blobs as parsed when
they're actually parsed, 2005-04-28).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 blob.c |   21 ---------------------
 blob.h |    2 --
 2 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/blob.c b/blob.c
index bd7d078..ae320bd 100644
--- a/blob.c
+++ b/blob.c
@@ -23,24 +23,3 @@ int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
 	item->object.parsed = 1;
 	return 0;
 }
-
-int parse_blob(struct blob *item)
-{
-        enum object_type type;
-        void *buffer;
-        unsigned long size;
-	int ret;
-
-        if (item->object.parsed)
-                return 0;
-        buffer = read_sha1_file(item->object.sha1, &type, &size);
-        if (!buffer)
-                return error("Could not read %s",
-                             sha1_to_hex(item->object.sha1));
-        if (type != OBJ_BLOB)
-                return error("Object %s not a blob",
-                             sha1_to_hex(item->object.sha1));
-	ret = parse_blob_buffer(item, buffer, size);
-	free(buffer);
-	return ret;
-}
diff --git a/blob.h b/blob.h
index ea5d9e9..1f66b9d 100644
--- a/blob.h
+++ b/blob.h
@@ -13,6 +13,4 @@ struct blob *lookup_blob(const unsigned char *sha1);
 
 int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
 
-int parse_blob(struct blob *item);
-
 #endif /* BLOB_H */
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 07/18] parse-options.c: mark file-local function static
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 parse-options.c |    7 +++++--
 parse-options.h |    3 ---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index f559411..7bbed5f 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -3,6 +3,9 @@
 #include "cache.h"
 #include "commit.h"
 
+static int parse_options_usage(const char * const *usagestr,
+			       const struct option *opts);
+
 #define OPT_SHORT 1
 #define OPT_UNSET 2
 
@@ -560,8 +563,8 @@ void usage_msg_opt(const char *msg,
 	usage_with_options(usagestr, options);
 }
 
-int parse_options_usage(const char * const *usagestr,
-			const struct option *opts)
+static int parse_options_usage(const char * const *usagestr,
+			       const struct option *opts)
 {
 	return usage_with_options_internal(usagestr, opts, 0);
 }
diff --git a/parse-options.h b/parse-options.h
index f295a2c..72fa360 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -171,9 +171,6 @@ struct parse_opt_ctx_t {
 	const char *prefix;
 };
 
-extern int parse_options_usage(const char * const *usagestr,
-			       const struct option *opts);
-
 extern void parse_options_start(struct parse_opt_ctx_t *ctx,
 				int argc, const char **argv, const char *prefix,
 				int flags);
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 06/18] entry.c: mark file-local function static
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 cache.h |    3 ---
 entry.c |    2 +-
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/cache.h b/cache.h
index 3f9ee86..30b9048 100644
--- a/cache.h
+++ b/cache.h
@@ -473,9 +473,6 @@ extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_obje
 extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
 extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
 
-/* "careful lstat()" */
-extern int check_path(const char *path, int len, struct stat *st, int skiplen);
-
 #define REFRESH_REALLY		0x0001	/* ignore_valid */
 #define REFRESH_UNMERGED	0x0002	/* allow unmerged */
 #define REFRESH_QUIET		0x0004	/* be quiet about it */
diff --git a/entry.c b/entry.c
index 06d24f1..55b988e 100644
--- a/entry.c
+++ b/entry.c
@@ -179,7 +179,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
  * This is like 'lstat()', except it refuses to follow symlinks
  * in the path, after skipping "skiplen".
  */
-int check_path(const char *path, int len, struct stat *st, int skiplen)
+static int check_path(const char *path, int len, struct stat *st, int skiplen)
 {
 	const char *slash = path + len;
 
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 05/18] http.c: mark file-local functions static
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 http.c |   10 ++++++++--
 http.h |    9 ---------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/http.c b/http.c
index 5c3efb9..deab595 100644
--- a/http.c
+++ b/http.c
@@ -651,7 +651,7 @@ static void closedown_active_slot(struct active_request_slot *slot)
 	slot->in_use = 0;
 }
 
-void release_active_slot(struct active_request_slot *slot)
+static void release_active_slot(struct active_request_slot *slot)
 {
 	closedown_active_slot(slot);
 	if (slot->curl && curl_session_count > min_curl_sessions) {
@@ -834,7 +834,13 @@ int http_get_strbuf(const char *url, struct strbuf *result, int options)
 	return http_request(url, result, HTTP_REQUEST_STRBUF, options);
 }
 
-int http_get_file(const char *url, const char *filename, int options)
+/*
+ * Downloads an url and stores the result in the given file.
+ *
+ * If a previous interrupted download is detected (i.e. a previous temporary
+ * file is still around) the download is resumed.
+ */
+static int http_get_file(const char *url, const char *filename, int options)
 {
 	int ret;
 	struct strbuf tmpfile = STRBUF_INIT;
diff --git a/http.h b/http.h
index f828e1d..5c9441c 100644
--- a/http.h
+++ b/http.h
@@ -81,7 +81,6 @@ extern int start_active_slot(struct active_request_slot *slot);
 extern void run_active_slot(struct active_request_slot *slot);
 extern void finish_active_slot(struct active_request_slot *slot);
 extern void finish_all_active_slots(void);
-extern void release_active_slot(struct active_request_slot *slot);
 
 #ifdef USE_CURL_MULTI
 extern void fill_active_slots(void);
@@ -136,14 +135,6 @@ extern char *get_remote_object_url(const char *url, const char *hex,
 int http_get_strbuf(const char *url, struct strbuf *result, int options);
 
 /*
- * Downloads an url and stores the result in the given file.
- *
- * If a previous interrupted download is detected (i.e. a previous temporary
- * file is still around) the download is resumed.
- */
-int http_get_file(const char *url, const char *filename, int options);
-
-/*
  * Prints an error message using error() containing url and curl_errorstr,
  * and returns ret.
  */
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 18/18] symlinks.c: remove unused functions
From: Junio C Hamano @ 2010-01-12  7:53 UTC (permalink / raw)
  To: git; +Cc: Kjetil Barvik
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

invalidate_lstat_cache() and clear_lstat_cache() are not used anywhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 cache.h    |    2 --
 symlinks.c |   31 -------------------------------
 2 files changed, 0 insertions(+), 33 deletions(-)

diff --git a/cache.h b/cache.h
index 90edb5b..b4b2ba7 100644
--- a/cache.h
+++ b/cache.h
@@ -782,8 +782,6 @@ extern int has_symlink_leading_path(const char *name, int len);
 extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
 extern int has_symlink_or_noent_leading_path(const char *name, int len);
 extern int has_dirs_only_path(const char *name, int len, int prefix_len);
-extern void invalidate_lstat_cache(const char *name, int len);
-extern void clear_lstat_cache(void);
 extern void schedule_dir_for_removal(const char *name, int len);
 extern void remove_scheduled_dirs(void);
 
diff --git a/symlinks.c b/symlinks.c
index 7b0a86d..8860120 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -179,37 +179,6 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
 	return ret_flags;
 }
 
-/*
- * Invalidate the given 'name' from the cache, if 'name' matches
- * completely with the cache.
- */
-void invalidate_lstat_cache(const char *name, int len)
-{
-	int match_len, previous_slash;
-	struct cache_def *cache = &default_cache;	/* FIXME */
-
-	match_len = longest_path_match(name, len, cache->path, cache->len,
-				       &previous_slash);
-	if (len == match_len) {
-		if ((cache->track_flags & FL_DIR) && previous_slash > 0) {
-			cache->path[previous_slash] = '\0';
-			cache->len = previous_slash;
-			cache->flags = FL_DIR;
-		} else {
-			reset_lstat_cache(cache);
-		}
-	}
-}
-
-/*
- * Completely clear the contents of the cache
- */
-void clear_lstat_cache(void)
-{
-	struct cache_def *cache = &default_cache;	/* FIXME */
-	reset_lstat_cache(cache);
-}
-
 #define USE_ONLY_LSTAT  0
 
 /*
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 15/18] strbuf.c: remove unused function
From: Junio C Hamano @ 2010-01-12  7:52 UTC (permalink / raw)
  To: git
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

strbuf_tolower() is not used anywhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 strbuf.c |    7 -------
 strbuf.h |    1 -
 2 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/strbuf.c b/strbuf.c
index a6153dc..3fa81b3 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -91,13 +91,6 @@ void strbuf_ltrim(struct strbuf *sb)
 	sb->buf[sb->len] = '\0';
 }
 
-void strbuf_tolower(struct strbuf *sb)
-{
-	int i;
-	for (i = 0; i < sb->len; i++)
-		sb->buf[i] = tolower(sb->buf[i]);
-}
-
 struct strbuf **strbuf_split(const struct strbuf *sb, int delim)
 {
 	int alloc = 2, pos = 0;
diff --git a/strbuf.h b/strbuf.h
index fa07ecf..b37f06a 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -81,7 +81,6 @@ extern void strbuf_trim(struct strbuf *);
 extern void strbuf_rtrim(struct strbuf *);
 extern void strbuf_ltrim(struct strbuf *);
 extern int strbuf_cmp(const struct strbuf *, const struct strbuf *);
-extern void strbuf_tolower(struct strbuf *);
 
 extern struct strbuf **strbuf_split(const struct strbuf *, int delim);
 extern void strbuf_list_free(struct strbuf **);
-- 
1.6.6.280.ge295b7.dirty

^ permalink raw reply related

* [PATCH 17/18] object.c: remove unused functions
From: Junio C Hamano @ 2010-01-12  7:53 UTC (permalink / raw)
  To: git
In-Reply-To: <1263282781-25596-1-git-send-email-gitster@pobox.com>

object_list_append() and object_list_length}() are not used anywhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 object.c |   21 ---------------------
 object.h |    5 -----
 2 files changed, 0 insertions(+), 26 deletions(-)

diff --git a/object.c b/object.c
index fe8eaaf..3ca92c4 100644
--- a/object.c
+++ b/object.c
@@ -217,27 +217,6 @@ struct object_list *object_list_insert(struct object *item,
         return new_list;
 }
 
-void object_list_append(struct object *item,
-			struct object_list **list_p)
-{
-	while (*list_p) {
-		list_p = &((*list_p)->next);
-	}
-	*list_p = xmalloc(sizeof(struct object_list));
-	(*list_p)->next = NULL;
-	(*list_p)->item = item;
-}
-
-unsigned object_list_length(struct object_list *list)
-{
-	unsigned ret = 0;
-	while (list) {
-		list = list->next;
-		ret++;
-	}
-	return ret;
-}
-
 int object_list_contains(struct object_list *list, struct object *obj)
 {
 	while (list) {
diff --git a/object.h b/object.h
index 89dd0c4..82877c8 100644
--- a/object.h
+++ b/object.h
@@ -72,11 +72,6 @@ struct object *lookup_unknown_object(const unsigned  char *sha1);
 struct object_list *object_list_insert(struct object *item,
 				       struct object_list **list_p);
 
-void object_list_append(struct object *item,
-			struct object_list **list_p);
-
-unsigned object_list_length(struct object_list *list);
-
 int object_list_contains(struct object_list *list, struct object *obj);
 
 /* Object array handling .. */
-- 
1.6.6.280.ge295b7.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