Git development
 help / color / mirror / Atom feed
* Re: Git Screencast ?
From: Shawn O. Pearce @ 2007-11-23 20:58 UTC (permalink / raw)
  To: Johannes Gilger; +Cc: Michael Donaghy, git
In-Reply-To: <20071123101426.GA15902@dualtron.vpn.rwth-aachen.de>

Johannes Gilger <heipei@hackvalue.de> wrote:
> On 22/11/07 20:47, Michael Donaghy wrote:
> > Yes thank you , although a screen cast would still be ideal , the 
> > documentation is very good,
> > also , what do you think of git-gui ? , I think it is the best one
> 
> I think you're trying to hide the complexity of git. The problem with 
> graphical tools is that they hide complexity from the user, which in 
> some cases is only possibly/good if the user has understood the 
> underlying principles already.

Actually some users have found that its easier to grok the index
by using git-gui.  You can more directly see the state of update
actions, and it is fairly easy to stage/unstage individual hunks
of files through git-gui.  Once you get that down then seeking
the same methods through the command line isn't too difficult,
many of the terms in git-gui are the same as the command line term,
to make the transition back and forth easier for the user.

-- 
Shawn.

^ permalink raw reply

* Re: [WIP PATCH] Add 'git fast-export', the sister of 'git fast-import'
From: Shawn O. Pearce @ 2007-11-23 20:59 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: hanwen, git
In-Reply-To: <Pine.LNX.4.64.0711230149430.27959@racer.site>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Thu, 22 Nov 2007, Han-Wen Nienhuys wrote:
> 
> > > Maybe you want to specify if all blobs should be output first, and 
> > > then the commits?  Or files should be used?  But all of these things 
> > > seem to be useless to me.
> > 
> > No, I want the program to wait for me to tell it what 
> > blobs/commits/trees I want. The commit I want to see secondly may depend 
> > on the output I read in the first request blob. Right now, for each data 
> > dependency I have to start a new git process.
> 
> It does not seem like you want a mirror of fast-import, but rather a 
> driver.  You might be happy to hear that you can do that already.  Today.
> However, you probably want to query different programs about certain 
> states of the repository.  This will not change.
> 
> > > > Besides being a nuisance, I actually run git on NFS, and every git 
> > > > process has to go to NFS a couple times to retrieve the same 
> > > > information. This has a noticeable performance impact.

I have been considering creating a "git-gui daemon" process that
links to libgit.a and can be driven bidirectionally through its
stdin/stdout.  Based on git-fast-export, sorta.  But I haven't
even started it...

But the idea is sort of what Han-Wen wants.  Why should I fork
rev-parse to get a ref value?  Or update-ref to change one?

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH v2] git-add--interactive pathspec and patch additions
From: Junio C Hamano @ 2007-11-23 21:07 UTC (permalink / raw)
  To: Wincent Colaiuta; +Cc: git, peff
In-Reply-To: <1195845650-85962-1-git-send-email-win@wincent.com>

Wincent Colaiuta <win@wincent.com> writes:

> The series implements these changes in seven steps that apply on top of
> "master"; these patches are rebased/squashed ones which *replace* the
> ones sent the other day:

That's very unfortunate, as some already usable bits from the
series are already in 'next'.

>     1. Add -q/--quiet switch to git-ls-files
>
> Needed because run_cmd_pipe() doesn't propagate the child exit status
> and system() likes to be chatty on the standard out. Of the possible
> workarounds adding this switch seems to be the cleanest and most
> portable.

I do not like this very much.  If it is a problem that
run_cmd_pipe() does not properly signal you an error, wouldn't
it be much better to fix _that_ problem?  That way we do not
have to add kludge to all commands we need to run and get the
exit status out of.

>     2. Rename patch_update_file function to patch_update_pathspec
>
> Merely cosmetic.
>
>     3. Add path-limiting to git-add--interactive
>     4. Bail if user supplies an invalid pathspec

On the first read, I did not quite like 4, but I'd agree it is
probably the cleanest implementation for 3 to reject a wrong
invocation early.

>     5. Teach builtin-add to pass path arguments to git-add--interactive

I think this is already in 'next'.

>     6. Add "--patch" option to git-add--interactive
>     7. Teach builtin-add to handle "--patch" option

These should be straightforward, but use of Getopt::Long feels
way overkill for an internal command like add--interactive which
is called by only a very limited known callers (exactly one).

If we assume "a single caller", we probably can do without 1 and
4, by making the caller in builtin-add to validate the list of
pathspecs, reusing the code for "ls-files --error-unmatch",
before calling the external helper "add--interactive".

There are functions refactored as part of the builtin-commit
series to be usable from outside "ls-files", and you can build a
imple function called from interactive_add(ac, av) using them:

static int validate_pathspec(const char *prefix, const char **pattern)
{
	int i, ret;
	char *m;

	if (!pattern || !*pattern)
        	return 0;

	for (i = 0; pattern[i]; i++)
		;
	m = xcalloc(1, i);

	for (i = 0; i < active_nr; i++) {
		struct cache_entry *ce = active_cache[i];
                (void) pathspec_match(pattern, m, ce->name, 0);
	}
        ret = report_path_error(m, pattern, prefix ? strlen(prefix) : 0);
        free(m);
        return ret;
}

^ permalink raw reply

* Re: [PATCH v2] git-add--interactive pathspec and patch additions
From: Wincent Colaiuta @ 2007-11-23 22:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, peff
In-Reply-To: <7vk5o8smaf.fsf@gitster.siamese.dyndns.org>

El 23/11/2007, a las 22:07, Junio C Hamano escribió:

> Wincent Colaiuta <win@wincent.com> writes:
>
>> The series implements these changes in seven steps that apply on  
>> top of
>> "master"; these patches are rebased/squashed ones which *replace* the
>> ones sent the other day:
>
> That's very unfortunate, as some already usable bits from the
> series are already in 'next'.

Well, no problem, I'll redo this tomorrow if I can get some free time.  
Otherwise it will have to wait to Monday.

>>    1. Add -q/--quiet switch to git-ls-files
>>
>> Needed because run_cmd_pipe() doesn't propagate the child exit status
>> and system() likes to be chatty on the standard out. Of the possible
>> workarounds adding this switch seems to be the cleanest and most
>> portable.
>
> I do not like this very much.  If it is a problem that
> run_cmd_pipe() does not properly signal you an error, wouldn't
> it be much better to fix _that_ problem?  That way we do not
> have to add kludge to all commands we need to run and get the
> exit status out of.

The problem is that run_cmd_pipe has two code paths, one for Windows  
and one for all the rest.

I could "fix" the non-Windows path by reading in all the command input  
at once and explicitly doing a close() before returning. In that case  
I believe that the exit status would be correctly set before the  
function returns. The Windows code path, however, I am reluctant to  
touch as I don't know its behaviour and can't test it.

The other alternative was to use qx() or backticks, but then I would  
have to start worrying about sanitizing paths and once again because  
of the dual-platform issues I was hesitant to do that. And how do you  
redirect to /dev/null on Windows?

In any case, I actually *like* the addition of -q to git-ls-files. I  
can see some places in the codebase (look in git-commit.sh, for  
instance) where git-ls-files is run and the output is thrown away  
(redirected to /dev/null) because it's not at all interesting to the  
caller. It seems that there is a real use case there which amounts to  
"just tell me whether these pathspecs are valid or not, I don't care  
about any of the rest".

>>    6. Add "--patch" option to git-add--interactive
>>    7. Teach builtin-add to handle "--patch" option
>
> These should be straightforward, but use of Getopt::Long feels
> way overkill for an internal command like add--interactive which
> is called by only a very limited known callers (exactly one).
>
> If we assume "a single caller", we probably can do without 1 and
> 4, by making the caller in builtin-add to validate the list of
> pathspecs, reusing the code for "ls-files --error-unmatch",
> before calling the external helper "add--interactive".

Well, you're probably right. I was thinking, "just in case we ever  
need to add more options"; but it may be that we never do, and perhaps  
git-add--interactive will become builtin one day anyway.

> There are functions refactored as part of the builtin-commit
> series to be usable from outside "ls-files", and you can build a
> imple function called from interactive_add(ac, av) using them:
>
> static int validate_pathspec(const char *prefix, const char **pattern)

Ok, thanks for the tip, Junio. Like I said, will look at this either  
tomorrow or Monday and get something posted that applies on top of  
"next".

Cheers,
Wincent

^ permalink raw reply

* Re: Git Screencast ?
From: Michael Donaghy @ 2007-11-23 23:18 UTC (permalink / raw)
  To: git
In-Reply-To: <20071123101426.GA15902@dualtron.vpn.rwth-aachen.de>

Johannes Gilger wrote:
> On 22/11/07 20:47, Michael Donaghy wrote:
>> Yes thank you , although a screen cast would still be ideal , the 
>> documentation is very good,
>> also , what do you think of git-gui ? , I think it is the best one
> 
> Hi Michael,
> 
> I think you're trying to hide the complexity of git. The problem with 
> graphical tools is that they hide complexity from the user, which in 
> some cases is only possibly/good if the user has understood the 
> underlying principles already. Also I think that there are many things 
> which can be done much quicker using a command-line than any gui (as all 
> of the people here will agree). Git is not Time-Machine (this thing from 
> Apple). It is also no good idea to try to view git from a svn's point of 
> view, or try to compare commands. It took me a while to get over that 
> and accept that git is different. I was frustated (and still am 
> sometimes) but i finally understood the whole concept.
> 
> About screencasts: I haven't watched that many screencasts in general, 
> but I can hardly imagine that they are better way of teaching things 
> than reading a manual. Watching someone type in commands, hitting 
> "Pause", then trying it myself doesn't seem more intuitive to me than 
> just reading a manual and typing the commands given in regular 
> intervals. Maybe someone can enlighten me about the use of screencasts 
> (in a command-line environment).
> 
> Greetings,
> Jojo
> 

I don't know , maybe I learn differently , but
 >'Watching someone type in commands, hitting  "Pause", then trying it
 > myself'
is intuitive for me :)

^ permalink raw reply

* git bundle magic, and other questions
From: Jakub Narebski @ 2007-11-23 23:33 UTC (permalink / raw)
  To: git

Do there exists some agreed upon common extension for git-bundle, or is 
it just *.bundle (like *.patch)? Do bundles use some magic identifier;
can I add something (and what) to the 'magic' file, so "file <bundle>"
would return "git bundle data" (or equivalent)?

Can I view contents of bundle in gitk or qgit, or giggle?

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: [PATCH] Don't add To: recipients to the Cc: header
From: Junio C Hamano @ 2007-11-23 23:54 UTC (permalink / raw)
  To: Sergei Organov; +Cc: Ask Bjørn Hansen, git
In-Reply-To: <87hcjcra10.fsf@osv.gnss.ru>

Sergei Organov <osv@javad.com> writes:

> Yeah, it's one valid interpretation. Here is another one:
> ...
> taken from here: <http://www.answers.com/topic/diff?cat=technology>

Rants about how dangerous GNU patch liberally (mis)interprets a
broken patch and git-apply is written deliberately more strict
have been repeated on this list, and I would not steal it from
Linus in this response.

>> The diff editing mode of Emacs, at least the version that caused
>> this issue, however did not make use of that information.
>
> IMHO it's rather useless to argue about it without strict definition of
> correct format of a patch (do you have one?)

Yes.  2004 POSIX does not talk about unified context, but Austin
group's SD5-XCU-ERN-103/120 has additions to define unified
context and renames the traditional '-c' output to "copied
context".  Obviously it defines what the numbers on the hunk
header lines mean quite precisely.  GNU folks even managed to
insert text that allows a completely empty line (not a line with
a single SP on it) to express a context line that is empty,
which means...

> However, it's easy to add
> an empty line for format-patch and very difficult, if not impossible,
> for Emacs to handle this without such a line.
>
> Therefore I repeat my question: are there any objections to add such an
> empty line by format-patch?

... there is a strong objection, if you are talking about adding
an empty line before "-- \n" that is in front of the GIT version
signature: such an empty line would not help at all.  A broken
implementation will just skip over such an empty line, counting
it as a line common to both preimage and postimage, and will
still miscount the e-mail signature separator "-- \n" as a line
removed from the preimage.

Having said that, the _ONLY_ reason I made format-patch end its
output with "-- \n" with GIT version was because I wanted to do
an informal census of the user community by observing mailing
list traffic of projects that use git.  The tool has since
matured, and census in such a form is not so important anymore.

If we wanted to have a workaround to this issue, we could simply
remove these last two lines, and that would a be much better one
than an extra blank line.  I do not have a strong objection to
such a change, but you would need to adjust the tests.  The most
depressing part of the whole exercise would be to make sure that
the adjustments to the tests are correct.

^ permalink raw reply

* Re: Temporary directories getting errantly added into trees
From: Sam Vilain @ 2007-11-24  0:07 UTC (permalink / raw)
  To: Karl Hasselström; +Cc: Johannes Schindelin, Git Mailing List
In-Reply-To: <20071123082103.GA11236@diana.vm.bytemark.co.uk>

Karl Hasselström wrote:
>> But I don't know about QGit, StGit, etc...
>>     
> I don't think StGit relies on the name of any file outside .git. (It
> does pollute the root of the worktree with some temp files of its own,
> though -- but not across invocations.)
>   

Yes, I've had to add .tmp_msg* to my .git/info/exclude for those, too. 
Given nothing cares, perhaps put them under .git anyway?

Sam.

^ permalink raw reply

* [RFC/PATCH] git-help: add new options -w (for web) and -i (for info)
From: Christian Couder @ 2007-11-24  4:16 UTC (permalink / raw)
  To: Junio Hamano; +Cc: git, Theodore Tso

With option -i or --info "git help" will call "info git-XXX".

With option -w or --web "git help" will call a new shell script
"git-html-help" that will try to show the HTML version of the
man page in your prefered web browser.

This currently works only if the HTML versions of the man page
have been installed in "PREFIX/share/doc/git-doc", so new target
to do that is added to "Documentation/Makefile".

The code in "git-html-help" is heavily stolen from "git-mergetool".
Thanks.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 Documentation/Makefile |    4 ++
 Makefile               |    4 +-
 git-html-help.sh       |  125 ++++++++++++++++++++++++++++++++++++++++++++++++
 help.c                 |   48 +++++++++++++++---
 4 files changed, 172 insertions(+), 9 deletions(-)
 create mode 100755 git-html-help.sh

diff --git a/Documentation/Makefile b/Documentation/Makefile
index d886641..3e01718 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -29,6 +29,7 @@ DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
 
 prefix?=$(HOME)
 bindir?=$(prefix)/bin
+htmldir?=$(prefix)/share/doc/git-doc
 mandir?=$(prefix)/share/man
 man1dir=$(mandir)/man1
 man5dir=$(mandir)/man5
@@ -95,6 +96,9 @@ install-info: info
 	  echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 	fi
 
+install-html: html
+	sh ./install-webdoc.sh $(htmldir)
+
 ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 	$(MAKE) -C ../ GIT-VERSION-FILE
 
diff --git a/Makefile b/Makefile
index 313f9a2..6ccf7e7 100644
--- a/Makefile
+++ b/Makefile
@@ -223,7 +223,8 @@ SCRIPT_SH = \
 	git-merge-resolve.sh \
 	git-lost-found.sh git-quiltimport.sh git-submodule.sh \
 	git-filter-branch.sh \
-	git-stash.sh
+	git-stash.sh \
+	git-html-help.sh
 
 SCRIPT_PERL = \
 	git-add--interactive.perl \
@@ -807,6 +808,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
+	    -e 's|@@PREFIX@@|$(prefix_SQ)|g' \
 	    $@.sh >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
diff --git a/git-html-help.sh b/git-html-help.sh
new file mode 100755
index 0000000..286d3b5
--- /dev/null
+++ b/git-html-help.sh
@@ -0,0 +1,125 @@
+#!/bin/sh
+#
+# This program launch a web browser on the html page
+# describing a git command.
+#
+# Copyright (c) 2007 Christian Couder
+# Copyright (c) 2006 Theodore Y. Ts'o
+#
+# This file is heavily stolen from git-mergetool.sh, by
+# Theodore Y. Ts'o (thanks) that is:
+#
+# Copyright (c) 2006 Theodore Y. Ts'o
+#
+# This file is licensed under the GPL v2, or a later version
+# at the discretion of Junio C Hamano or any other official
+# git maintainer.
+#
+
+USAGE='[--tool=tool] [cmd to display] ...'
+SUBDIRECTORY_OK=Yes
+OPTIONS_SPEC=
+. git-sh-setup
+
+valid_tool() {
+	case "$1" in
+		firefox | iceweasel | konqueror | w3m)
+			;; # happy
+		*)
+			return 1
+			;;
+	esac
+}
+
+init_browser_path() {
+	browser_path=`git config webtool.$1.path`
+	test -z "$browser_path" && browser_path=$1
+}
+
+while test $# != 0
+do
+    case "$1" in
+	-t|--tool*)
+	    case "$#,$1" in
+		*,*=*)
+		    browser=`expr "z$1" : 'z-[^=]*=\(.*\)'`
+		    ;;
+		1,*)
+		    usage ;;
+		*)
+		    browser="$2"
+		    shift ;;
+	    esac
+	    ;;
+	--)
+	    break
+	    ;;
+	-*)
+	    usage
+	    ;;
+	*)
+	    break
+	    ;;
+    esac
+    shift
+done
+
+if test -z "$browser"; then
+    browser=`git config web.tool`
+    if test -n "$browser" && ! valid_tool "$browser"; then
+	    echo >&2 "git config option web.tool set to unknown tool: $browser"
+	    echo >&2 "Resetting to default..."
+	    unset browser
+    fi
+fi
+
+if test -z "$browser" ; then
+    if test -n "$DISPLAY"; then
+        browser_candidates="firefox iceweasel konqueror w3m"
+        if test "$KDE_FULL_SESSION" = "true"; then
+            browser_candidates="konqueror $browser_candidates"
+        fi
+    else
+        browser_candidates="w3m"
+    fi
+    echo "browser candidates: $browser_candidates"
+    for i in $browser_candidates; do
+        init_browser_path $i
+	echo "browser path: $browser_path"
+        if type "$browser_path" > /dev/null 2>&1; then
+            browser=$i
+            break
+        fi
+    done
+    test -z "$browser" && die "No known browser available."
+else
+    valid_tool "$browser" || die "Unknown browser $browser"
+
+    init_browser_path "$browser"
+
+    if ! type "$browser_path" > /dev/null 2>&1; then
+        die "The browser $browser is not available as '$browser_path'"
+    fi
+fi
+
+html_dir="@@PREFIX@@/share/doc/git-doc"
+pages=$(for p in "$@"; do echo "$html_dir/$p.html" ; done)
+test -z "$pages" && pages="$html_dir/git.html"
+
+case "$browser" in
+    firefox|iceweasel)
+        # TODO check version (firefox < 2.0 does not support -new-tab)
+        nohup "$browser" -new-tab $pages &
+	;;
+    konqueror)
+        # FIXME: we may want to find an existing konqueror and use
+        # dcop to tell it what to do.
+        nohup "$browser" $pages &
+        ;;
+    w3m)
+        eval "$browser" $pages
+        ;;
+esac
+
+
+
diff --git a/help.c b/help.c
index 37a9c25..a5602a2 100644
--- a/help.c
+++ b/help.c
@@ -239,24 +239,38 @@ void list_common_cmds_help(void)
 	}
 }
 
-static void show_man_page(const char *git_cmd)
+static const char *cmd_to_page(const char *git_cmd)
 {
-	const char *page;
-
 	if (!prefixcmp(git_cmd, "git"))
-		page = git_cmd;
+		return git_cmd;
 	else {
 		int page_len = strlen(git_cmd) + 4;
 		char *p = xmalloc(page_len + 1);
 		strcpy(p, "git-");
 		strcpy(p + 4, git_cmd);
 		p[page_len] = 0;
-		page = p;
+		return p;
 	}
+}
 
+static void show_man_page(const char *git_cmd)
+{
+	const char *page = cmd_to_page(git_cmd);
 	execlp("man", "man", page, NULL);
 }
 
+static void show_info_page(const char *git_cmd)
+{
+	const char *page = cmd_to_page(git_cmd);
+	execlp("info", "info", page, NULL);
+}
+
+static void show_html_page(const char *git_cmd)
+{
+	const char *page = cmd_to_page(git_cmd);
+	execlp("git-html-help", "git-html-help", page, NULL);
+}
+
 void help_unknown_cmd(const char *cmd)
 {
 	fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd);
@@ -269,10 +283,8 @@ int cmd_version(int argc, const char **argv, const char *prefix)
 	return 0;
 }
 
-int cmd_help(int argc, const char **argv, const char *prefix)
+static void check_help_cmd(const char *help_cmd)
 {
-	const char *help_cmd = argc > 1 ? argv[1] : NULL;
-
 	if (!help_cmd) {
 		printf("usage: %s\n\n", git_usage_string);
 		list_common_cmds_help();
@@ -284,6 +296,26 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 		list_commands();
 		exit(0);
 	}
+}
+
+int cmd_help(int argc, const char **argv, const char *prefix)
+{
+	const char *help_cmd = argc > 1 ? argv[1] : NULL;
+	check_help_cmd(help_cmd);
+
+	if (!strcmp(help_cmd, "--web") || !strcmp(help_cmd, "-w")) {
+		help_cmd = argc > 2 ? argv[2] : NULL;
+		check_help_cmd(help_cmd);
+
+		show_html_page(help_cmd);
+	}
+
+	else if (!strcmp(help_cmd, "--info") || !strcmp(help_cmd, "-i")) {
+		help_cmd = argc > 2 ? argv[2] : NULL;
+		check_help_cmd(help_cmd);
+
+		show_info_page(help_cmd);
+	}
 
 	else
 		show_man_page(help_cmd);
-- 
1.5.3.5.1730.g6d12d-dirty

^ permalink raw reply related

* [PATCH 1/2] builtin-apply: rename "whitespace" variables and fix styles
From: Junio C Hamano @ 2007-11-24  4:24 UTC (permalink / raw)
  To: git

The variables were somewhat misnamed.

 * "What to do when whitespace errors are detected" is now called
   "ws_error_action" (used to be called "new_whitespace");

 * The constants to denote the possible actions are "nowarn_ws_error",
   "warn_on_ws_error", "die_on_ws_error", and "correct_ws_error".  The
   last one used to be "strip_whitespace", but we correct whitespace
   error in indent (SP followed by HT) and "strip" is not quite an
   accurate name for it.

Other than the renaming of variables and constants, there is no
functional change in this patch.  While we are at it, it also fixes
overly long lines and multi-line comment styles (which of course do
not affect the generated code at all).

Ah, by the way, this introduces a synonym "fix" that is equivalent to
"strip" that you can give to --whitespace=<what-to-do>, so in that sense
it is not exactly "no functional change whatsoever".

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

 * This is on top of jc/spht topic that is in 'next'.  The next one is
   the real thing.

 builtin-apply.c |  148 ++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 91 insertions(+), 57 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 8411b38..eb09bfe 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -47,12 +47,12 @@ static unsigned long p_context = ULONG_MAX;
 static const char apply_usage[] =
 "git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|error|error-all|strip>] <patch>...";
 
-static enum whitespace_eol {
-	nowarn_whitespace,
-	warn_on_whitespace,
-	error_on_whitespace,
-	strip_whitespace,
-} new_whitespace = warn_on_whitespace;
+static enum ws_error_action {
+	nowarn_ws_error,
+	warn_on_ws_error,
+	die_on_ws_error,
+	correct_ws_error,
+} ws_error_action = warn_on_ws_error;
 static int whitespace_error;
 static int squelch_whitespace_errors = 5;
 static int applied_after_fixing_ws;
@@ -61,28 +61,28 @@ static const char *patch_input_file;
 static void parse_whitespace_option(const char *option)
 {
 	if (!option) {
-		new_whitespace = warn_on_whitespace;
+		ws_error_action = warn_on_ws_error;
 		return;
 	}
 	if (!strcmp(option, "warn")) {
-		new_whitespace = warn_on_whitespace;
+		ws_error_action = warn_on_ws_error;
 		return;
 	}
 	if (!strcmp(option, "nowarn")) {
-		new_whitespace = nowarn_whitespace;
+		ws_error_action = nowarn_ws_error;
 		return;
 	}
 	if (!strcmp(option, "error")) {
-		new_whitespace = error_on_whitespace;
+		ws_error_action = die_on_ws_error;
 		return;
 	}
 	if (!strcmp(option, "error-all")) {
-		new_whitespace = error_on_whitespace;
+		ws_error_action = die_on_ws_error;
 		squelch_whitespace_errors = 0;
 		return;
 	}
-	if (!strcmp(option, "strip")) {
-		new_whitespace = strip_whitespace;
+	if (!strcmp(option, "strip") || !strcmp(option, "fix")) {
+		ws_error_action = correct_ws_error;
 		return;
 	}
 	die("unrecognized whitespace option '%s'", option);
@@ -90,11 +90,8 @@ static void parse_whitespace_option(const char *option)
 
 static void set_default_whitespace_mode(const char *whitespace_option)
 {
-	if (!whitespace_option && !apply_default_whitespace) {
-		new_whitespace = (apply
-				  ? warn_on_whitespace
-				  : nowarn_whitespace);
-	}
+	if (!whitespace_option && !apply_default_whitespace)
+		ws_error_action = (apply ? warn_on_ws_error : nowarn_ws_error);
 }
 
 /*
@@ -137,6 +134,11 @@ struct fragment {
 #define BINARY_DELTA_DEFLATED	1
 #define BINARY_LITERAL_DEFLATED 2
 
+/*
+ * This represents a "patch" to a file, both metainfo changes
+ * such as creation/deletion, filemode and content changes represented
+ * as a series of fragments.
+ */
 struct patch {
 	char *new_name, *old_name, *def_name;
 	unsigned int old_mode, new_mode;
@@ -158,7 +160,8 @@ struct patch {
 	struct patch *next;
 };
 
-static void say_patch_name(FILE *output, const char *pre, struct patch *patch, const char *post)
+static void say_patch_name(FILE *output, const char *pre,
+			   struct patch *patch, const char *post)
 {
 	fputs(pre, output);
 	if (patch->old_name && patch->new_name &&
@@ -229,7 +232,8 @@ static char *find_name(const char *line, char *def, int p_value, int terminate)
 	if (*line == '"') {
 		struct strbuf name;
 
-		/* Proposed "new-style" GNU patch/diff format; see
+		/*
+		 * Proposed "new-style" GNU patch/diff format; see
 		 * http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2
 		 */
 		strbuf_init(&name, 0);
@@ -499,7 +503,8 @@ static int gitdiff_dissimilarity(const char *line, struct patch *patch)
 
 static int gitdiff_index(const char *line, struct patch *patch)
 {
-	/* index line is N hexadecimal, "..", N hexadecimal,
+	/*
+	 * index line is N hexadecimal, "..", N hexadecimal,
 	 * and optional space with octal mode.
 	 */
 	const char *ptr, *eol;
@@ -550,7 +555,8 @@ static const char *stop_at_slash(const char *line, int llen)
 	return NULL;
 }
 
-/* This is to extract the same name that appears on "diff --git"
+/*
+ * This is to extract the same name that appears on "diff --git"
  * line.  We do not find and return anything if it is a rename
  * patch, and it is OK because we will find the name elsewhere.
  * We need to reliably find name only when it is mode-change only,
@@ -584,7 +590,8 @@ static char *git_header_name(char *line, int llen)
 			goto free_and_fail1;
 		strbuf_remove(&first, 0, cp + 1 - first.buf);
 
-		/* second points at one past closing dq of name.
+		/*
+		 * second points at one past closing dq of name.
 		 * find the second name.
 		 */
 		while ((second < line + llen) && isspace(*second))
@@ -627,7 +634,8 @@ static char *git_header_name(char *line, int llen)
 		return NULL;
 	name++;
 
-	/* since the first name is unquoted, a dq if exists must be
+	/*
+	 * since the first name is unquoted, a dq if exists must be
 	 * the beginning of the second name.
 	 */
 	for (second = name; second < line + llen; second++) {
@@ -759,7 +767,7 @@ static int parse_num(const char *line, unsigned long *p)
 }
 
 static int parse_range(const char *line, int len, int offset, const char *expect,
-			unsigned long *p1, unsigned long *p2)
+		       unsigned long *p1, unsigned long *p2)
 {
 	int digits, ex;
 
@@ -868,14 +876,14 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
 			return offset;
 		}
 
-		/** --- followed by +++ ? */
+		/* --- followed by +++ ? */
 		if (memcmp("--- ", line,  4) || memcmp("+++ ", line + len, 4))
 			continue;
 
 		/*
 		 * We only accept unified patches, so we want it to
 		 * at least have "@@ -a,b +c,d @@\n", which is 14 chars
-		 * minimum
+		 * minimum ("@@ -0,0 +1 @@\n" is the shortest).
 		 */
 		nextlen = linelen(line + len, size - len);
 		if (size < nextlen + 14 || memcmp("@@ -", line + len + nextlen, 4))
@@ -932,14 +940,14 @@ static void check_whitespace(const char *line, int len)
 			err, patch_input_file, linenr, len-2, line+1);
 }
 
-
 /*
  * Parse a unified diff. Note that this really needs to parse each
  * fragment separately, since the only way to know the difference
  * between a "---" that is part of a patch, and a "---" that starts
  * the next patch is to look at the line counts..
  */
-static int parse_fragment(char *line, unsigned long size, struct patch *patch, struct fragment *fragment)
+static int parse_fragment(char *line, unsigned long size,
+			  struct patch *patch, struct fragment *fragment)
 {
 	int added, deleted;
 	int len = linelen(line, size), offset;
@@ -980,7 +988,7 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
 			break;
 		case '-':
 			if (apply_in_reverse &&
-					new_whitespace != nowarn_whitespace)
+			    ws_error_action != nowarn_ws_error)
 				check_whitespace(line, len);
 			deleted++;
 			oldlines--;
@@ -988,14 +996,15 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
 			break;
 		case '+':
 			if (!apply_in_reverse &&
-					new_whitespace != nowarn_whitespace)
+			    ws_error_action != nowarn_ws_error)
 				check_whitespace(line, len);
 			added++;
 			newlines--;
 			trailing = 0;
 			break;
 
-                /* We allow "\ No newline at end of file". Depending
+		/*
+		 * We allow "\ No newline at end of file". Depending
                  * on locale settings when the patch was produced we
                  * don't know what this line looks like. The only
                  * thing we do know is that it begins with "\ ".
@@ -1013,7 +1022,8 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
 	fragment->leading = leading;
 	fragment->trailing = trailing;
 
-	/* If a fragment ends with an incomplete line, we failed to include
+	/*
+	 * If a fragment ends with an incomplete line, we failed to include
 	 * it in the above loop because we hit oldlines == newlines == 0
 	 * before seeing it.
 	 */
@@ -1141,7 +1151,8 @@ static struct fragment *parse_binary_hunk(char **buf_p,
 					  int *status_p,
 					  int *used_p)
 {
-	/* Expect a line that begins with binary patch method ("literal"
+	/*
+	 * Expect a line that begins with binary patch method ("literal"
 	 * or "delta"), followed by the length of data before deflating.
 	 * a sequence of 'length-byte' followed by base-85 encoded data
 	 * should follow, terminated by a newline.
@@ -1190,7 +1201,8 @@ static struct fragment *parse_binary_hunk(char **buf_p,
 			size--;
 			break;
 		}
-		/* Minimum line is "A00000\n" which is 7-byte long,
+		/*
+		 * Minimum line is "A00000\n" which is 7-byte long,
 		 * and the line length must be multiple of 5 plus 2.
 		 */
 		if ((llen < 7) || (llen-2) % 5)
@@ -1241,7 +1253,8 @@ static struct fragment *parse_binary_hunk(char **buf_p,
 
 static int parse_binary(char *buffer, unsigned long size, struct patch *patch)
 {
-	/* We have read "GIT binary patch\n"; what follows is a line
+	/*
+	 * We have read "GIT binary patch\n"; what follows is a line
 	 * that says the patch method (currently, either "literal" or
 	 * "delta") and the length of data before deflating; a
 	 * sequence of 'length-byte' followed by base-85 encoded data
@@ -1271,7 +1284,8 @@ static int parse_binary(char *buffer, unsigned long size, struct patch *patch)
 	if (reverse)
 		used += used_1;
 	else if (status) {
-		/* not having reverse hunk is not an error, but having
+		/*
+		 * Not having reverse hunk is not an error, but having
 		 * a corrupt reverse hunk is.
 		 */
 		free((void*) forward->patch);
@@ -1292,7 +1306,8 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch)
 	if (offset < 0)
 		return offset;
 
-	patchsize = parse_single_patch(buffer + offset + hdrsize, size - offset - hdrsize, patch);
+	patchsize = parse_single_patch(buffer + offset + hdrsize,
+				       size - offset - hdrsize, patch);
 
 	if (!patchsize) {
 		static const char *binhdr[] = {
@@ -1368,8 +1383,10 @@ static void reverse_patches(struct patch *p)
 	}
 }
 
-static const char pluses[] = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
-static const char minuses[]= "----------------------------------------------------------------------";
+static const char pluses[] =
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
+static const char minuses[]=
+"----------------------------------------------------------------------";
 
 static void show_stats(struct patch *patch)
 {
@@ -1438,7 +1455,9 @@ static int read_old_data(struct stat *st, const char *path, struct strbuf *buf)
 	}
 }
 
-static int find_offset(const char *buf, unsigned long size, const char *fragment, unsigned long fragsize, int line, int *lines)
+static int find_offset(const char *buf, unsigned long size,
+		       const char *fragment, unsigned long fragsize,
+		       int line, int *lines)
 {
 	int i;
 	unsigned long start, backwards, forwards;
@@ -1539,7 +1558,8 @@ static void remove_last_line(const char **rbuf, int *rsize)
 
 static int apply_line(char *output, const char *patch, int plen)
 {
-	/* plen is number of bytes to be copied from patch,
+	/*
+	 * plen is number of bytes to be copied from patch,
 	 * starting at patch+1 (patch[0] is '+').  Typically
 	 * patch[plen] is '\n', unless this is the incomplete
 	 * last line.
@@ -1552,12 +1572,15 @@ static int apply_line(char *output, const char *patch, int plen)
 	int need_fix_leading_space = 0;
 	char *buf;
 
-	if ((new_whitespace != strip_whitespace) || !whitespace_error ||
+	if ((ws_error_action != correct_ws_error) || !whitespace_error ||
 	    *patch != '+') {
 		memcpy(output, patch + 1, plen);
 		return plen;
 	}
 
+	/*
+	 * Strip trailing whitespace
+	 */
 	if (1 < plen && isspace(patch[plen-1])) {
 		if (patch[plen] == '\n')
 			add_nl_to_tail = 1;
@@ -1567,6 +1590,9 @@ static int apply_line(char *output, const char *patch, int plen)
 		fixed = 1;
 	}
 
+	/*
+	 * Check leading whitespaces (indent)
+	 */
 	for (i = 1; i < plen; i++) {
 		char ch = patch[i];
 		if (ch == '\t') {
@@ -1583,7 +1609,8 @@ static int apply_line(char *output, const char *patch, int plen)
 	buf = output;
 	if (need_fix_leading_space) {
 		int consecutive_spaces = 0;
-		/* between patch[1..last_tab_in_indent] strip the
+		/*
+		 * between patch[1..last_tab_in_indent] strip the
 		 * funny spaces, updating them to tab as needed.
 		 */
 		for (i = 1; i < last_tab_in_indent; i++, plen--) {
@@ -1613,7 +1640,8 @@ static int apply_line(char *output, const char *patch, int plen)
 	return output + plen - buf;
 }
 
-static int apply_one_fragment(struct strbuf *buf, struct fragment *frag, int inaccurate_eof)
+static int apply_one_fragment(struct strbuf *buf, struct fragment *frag,
+			      int inaccurate_eof)
 {
 	int match_beginning, match_end;
 	const char *patch = frag->patch;
@@ -1695,8 +1723,9 @@ static int apply_one_fragment(struct strbuf *buf, struct fragment *frag, int ina
 		size -= len;
 	}
 
-	if (inaccurate_eof && oldsize > 0 && old[oldsize - 1] == '\n' &&
-			newsize > 0 && new[newsize - 1] == '\n') {
+	if (inaccurate_eof &&
+	    oldsize > 0 && old[oldsize - 1] == '\n' &&
+	    newsize > 0 && new[newsize - 1] == '\n') {
 		oldsize--;
 		newsize--;
 	}
@@ -1733,7 +1762,7 @@ static int apply_one_fragment(struct strbuf *buf, struct fragment *frag, int ina
 		if (match_beginning && offset)
 			offset = -1;
 		if (offset >= 0) {
-			if (new_whitespace == strip_whitespace &&
+			if (ws_error_action == correct_ws_error &&
 			    (buf->len - oldsize - offset == 0)) /* end of file? */
 				newsize -= new_blank_lines_at_end;
 
@@ -1758,9 +1787,10 @@ static int apply_one_fragment(struct strbuf *buf, struct fragment *frag, int ina
 			match_beginning = match_end = 0;
 			continue;
 		}
-		/* Reduce the number of context lines
-		 * Reduce both leading and trailing if they are equal
-		 * otherwise just reduce the larger context.
+		/*
+		 * Reduce the number of context lines; reduce both
+		 * leading and trailing if they are equal otherwise
+		 * just reduce the larger context.
 		 */
 		if (leading >= trailing) {
 			remove_first_line(&oldlines, &oldsize);
@@ -1820,7 +1850,8 @@ static int apply_binary(struct strbuf *buf, struct patch *patch)
 	const char *name = patch->old_name ? patch->old_name : patch->new_name;
 	unsigned char sha1[20];
 
-	/* For safety, we require patch index line to contain
+	/*
+	 * For safety, we require patch index line to contain
 	 * full 40-byte textual SHA1 for old and new, at least for now.
 	 */
 	if (strlen(patch->old_sha1_prefix) != 40 ||
@@ -1831,7 +1862,8 @@ static int apply_binary(struct strbuf *buf, struct patch *patch)
 			     "without full index line", name);
 
 	if (patch->old_name) {
-		/* See if the old one matches what the patch
+		/*
+		 * See if the old one matches what the patch
 		 * applies to.
 		 */
 		hash_sha1_file(buf->buf, buf->len, blob_type, sha1);
@@ -1868,7 +1900,8 @@ static int apply_binary(struct strbuf *buf, struct patch *patch)
 		/* XXX read_sha1_file NUL-terminates */
 		strbuf_attach(buf, result, size, size + 1);
 	} else {
-		/* We have verified buf matches the preimage;
+		/*
+		 * We have verified buf matches the preimage;
 		 * apply the patch data to it, which is stored
 		 * in the patch->fragments->{patch,size}.
 		 */
@@ -2067,7 +2100,8 @@ static int check_patch(struct patch *patch, struct patch *prev_patch)
 
 	if (new_name && prev_patch && 0 < prev_patch->is_delete &&
 	    !strcmp(prev_patch->old_name, new_name))
-		/* A type-change diff is always split into a patch to
+		/*
+		 * A type-change diff is always split into a patch to
 		 * delete old, immediately followed by a patch to
 		 * create new (see diff.c::run_diff()); in such a case
 		 * it is Ok that the entry to be deleted by the
@@ -2671,7 +2705,7 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
 		offset += nr;
 	}
 
-	if (whitespace_error && (new_whitespace == error_on_whitespace))
+	if (whitespace_error && (ws_error_action == die_on_ws_error))
 		apply = 0;
 
 	update_index = check_index && apply;
@@ -2866,7 +2900,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 				squelched,
 				squelched == 1 ? "" : "s");
 		}
-		if (new_whitespace == error_on_whitespace)
+		if (ws_error_action == die_on_ws_error)
 			die("%d line%s add%s whitespace errors.",
 			    whitespace_error,
 			    whitespace_error == 1 ? "" : "s",
-- 
1.5.3.6.1991.ge56ac

^ permalink raw reply related

* [PATCH 2/2] builtin-apply: teach whitespace_rules
From: Junio C Hamano @ 2007-11-24  4:25 UTC (permalink / raw)
  To: git
In-Reply-To: <7v8x4os223.fsf@gitster.siamese.dyndns.org>

We earlier introduced core.whitespace to allow users to tweak the
definition of what the "whitespace errors" are, for the purpose of diff
output highlighting.  This teaches the same to git-apply, so that the
command can both detect (when --whitespace=warn option is given) and fix
(when --whitespace=fix option is given) as configured.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-apply.c          |   68 +++++++++++++++++-------
 t/t4124-apply-ws-rule.sh |  133 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 182 insertions(+), 19 deletions(-)
 create mode 100755 t/t4124-apply-ws-rule.sh

diff --git a/builtin-apply.c b/builtin-apply.c
index eb09bfe..e04b493 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -910,23 +910,35 @@ static void check_whitespace(const char *line, int len)
 	 * this function.  That is, an addition of an empty line would
 	 * check the '+' here.  Sneaky...
 	 */
-	if (isspace(line[len-2]))
+	if ((whitespace_rule & WS_TRAILING_SPACE) && isspace(line[len-2]))
 		goto error;
 
 	/*
 	 * Make sure that there is no space followed by a tab in
 	 * indentation.
 	 */
-	err = "Space in indent is followed by a tab";
-	for (i = 1; i < len; i++) {
-		if (line[i] == '\t') {
-			if (seen_space)
-				goto error;
-		}
-		else if (line[i] == ' ')
-			seen_space = 1;
-		else
-			break;
+	if (whitespace_rule & WS_SPACE_BEFORE_TAB) {
+		err = "Space in indent is followed by a tab";
+		for (i = 1; i < len; i++) {
+			if (line[i] == '\t') {
+				if (seen_space)
+					goto error;
+			}
+			else if (line[i] == ' ')
+				seen_space = 1;
+			else
+				break;
+		}
+	}
+
+	/*
+	 * Make sure that the indentation does not contain more than
+	 * 8 spaces.
+	 */
+	if ((whitespace_rule & WS_INDENT_WITH_NON_TAB) &&
+	    (8 < len) && !strncmp("+        ", line, 9)) {
+		err = "Indent more than 8 places with spaces";
+		goto error;
 	}
 	return;
 
@@ -1581,7 +1593,8 @@ static int apply_line(char *output, const char *patch, int plen)
 	/*
 	 * Strip trailing whitespace
 	 */
-	if (1 < plen && isspace(patch[plen-1])) {
+	if ((whitespace_rule & WS_TRAILING_SPACE) &&
+	    (1 < plen && isspace(patch[plen-1]))) {
 		if (patch[plen] == '\n')
 			add_nl_to_tail = 1;
 		plen--;
@@ -1597,11 +1610,16 @@ static int apply_line(char *output, const char *patch, int plen)
 		char ch = patch[i];
 		if (ch == '\t') {
 			last_tab_in_indent = i;
-			if (0 <= last_space_in_indent)
+			if ((whitespace_rule & WS_SPACE_BEFORE_TAB) &&
+			    0 <= last_space_in_indent)
+			    need_fix_leading_space = 1;
+		} else if (ch == ' ') {
+			last_space_in_indent = i;
+			if ((whitespace_rule & WS_INDENT_WITH_NON_TAB) &&
+			    last_tab_in_indent < 0 &&
+			    8 <= i)
 				need_fix_leading_space = 1;
 		}
-		else if (ch == ' ')
-			last_space_in_indent = i;
 		else
 			break;
 	}
@@ -1609,11 +1627,21 @@ static int apply_line(char *output, const char *patch, int plen)
 	buf = output;
 	if (need_fix_leading_space) {
 		int consecutive_spaces = 0;
+		int last = last_tab_in_indent + 1;
+
+		if (whitespace_rule & WS_INDENT_WITH_NON_TAB) {
+			/* have "last" point at one past the indent */
+			if (last_tab_in_indent < last_space_in_indent)
+				last = last_space_in_indent + 1;
+			else
+				last = last_tab_in_indent + 1;
+		}
+
 		/*
-		 * between patch[1..last_tab_in_indent] strip the
-		 * funny spaces, updating them to tab as needed.
+		 * between patch[1..last], strip the funny spaces,
+		 * updating them to tab as needed.
 		 */
-		for (i = 1; i < last_tab_in_indent; i++, plen--) {
+		for (i = 1; i < last; i++, plen--) {
 			char ch = patch[i];
 			if (ch != ' ') {
 				consecutive_spaces = 0;
@@ -1626,8 +1654,10 @@ static int apply_line(char *output, const char *patch, int plen)
 				}
 			}
 		}
+		while (0 < consecutive_spaces--)
+			*output++ = ' ';
 		fixed = 1;
-		i = last_tab_in_indent;
+		i = last;
 	}
 	else
 		i = 1;
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
new file mode 100755
index 0000000..f53ac46
--- /dev/null
+++ b/t/t4124-apply-ws-rule.sh
@@ -0,0 +1,133 @@
+#!/bin/sh
+
+test_description='core.whitespace rules and git-apply'
+
+. ./test-lib.sh
+
+prepare_test_file () {
+
+	# A line that has character X is touched iff RULE is in effect:
+	#       X  RULE
+	#   	!  trailing-space
+	#   	@  space-before-tab
+	#   	#  indent-with-non-tab
+	sed -e "s/_/ /g" -e "s/>/	/" <<-\EOF
+		An_SP in an ordinary line>and a HT.
+		>A HT.
+		_>A SP and a HT (@).
+		_>_A SP, a HT and a SP (@).
+		_______Seven SP.
+		________Eight SP (#).
+		_______>Seven SP and a HT (@).
+		________>Eight SP and a HT (@#).
+		_______>_Seven SP, a HT and a SP (@).
+		________>_Eight SP, a HT and a SP (@#).
+		_______________Fifteen SP (#).
+		_______________>Fifteen SP and a HT (@#).
+		________________Sixteen SP (#).
+		________________>Sixteen SP and a HT (@#).
+		_____a__Five SP, a non WS, two SP.
+		A line with a (!) trailing SP_
+		A line with a (!) trailing HT>
+	EOF
+}
+
+apply_patch () {
+	>target &&
+	sed -e "s|\([ab]\)/file|\1/target|" <patch |
+	git apply "$@"
+}
+
+test_fix () {
+
+	# fix should not barf
+	apply_patch --whitespace=fix || return 1
+
+	# find touched lines
+	diff file target | sed -n -e "s/^> //p" >fixed
+
+	# the changed lines are all expeced to change
+	fixed_cnt=$(wc -l <fixed)
+	case "$1" in
+	'') expect_cnt=$fixed_cnt ;;
+	?*) expect_cnt=$(grep "[$1]" <fixed | wc -l) ;;
+	esac
+	test $fixed_cnt -eq $expect_cnt || return 1
+
+	# and we are not missing anything
+	case "$1" in
+	'') expect_cnt=0 ;;
+	?*) expect_cnt=$(grep "[$1]" <file | wc -l) ;;
+	esac
+	test $fixed_cnt -eq $expect_cnt || return 1
+
+	# Get the patch actually applied
+	git diff-files -p target >fixed-patch
+	test -s fixed-patch && return 0
+
+	# Make sure it is complaint-free
+	>target
+	git apply --whitespace=error-all <fixed-patch
+
+}
+
+test_expect_success setup '
+
+	>file &&
+	git add file &&
+	prepare_test_file >file &&
+	git diff-files -p >patch &&
+	>target &&
+	git add target
+
+'
+
+test_expect_success 'whitespace=nowarn, default rule' '
+
+	apply_patch --whitespace=nowarn &&
+	diff file target
+
+'
+
+test_expect_success 'whitespace=warn, default rule' '
+
+	apply_patch --whitespace=warn &&
+	diff file target
+
+'
+
+test_expect_success 'whitespace=error-all, default rule' '
+
+	apply_patch --whitespace=error-all && return 1
+	test -s target && return 1
+	: happy
+
+'
+
+test_expect_success 'whitespace=error-all, no rule' '
+
+	git config core.whitespace -trailing,-space-before,-indent &&
+	apply_patch --whitespace=error-all &&
+	diff file target
+
+'
+
+for t in - ''
+do
+	case "$t" in '') tt='!' ;; *) tt= ;; esac
+	for s in - ''
+	do
+		case "$s" in '') ts='@' ;; *) ts= ;; esac
+		for i in - ''
+		do
+			case "$i" in '') ti='#' ;; *) ti= ;; esac
+			rule=${t}trailing,${s}space,${i}indent &&
+			test_expect_success "rule=$rule" '
+				git config core.whitespace "$rule" &&
+				test_fix "$tt$ts$ti"
+			'
+		done
+	done
+done
+
+test_done
-- 
1.5.3.6.1991.ge56ac

^ permalink raw reply related

* QGit: Shrink used memory with custom git log format
From: Marco Costalba @ 2007-11-24  8:14 UTC (permalink / raw)
  To: Git Mailing List

Hi all,

   I have pushed a patch series to

git://git.kernel.org/pub/scm/qgit/qgit4.git

that changes the format of git log used to read data from a git repository.

Now instead of --pretty=raw a custom made --pretty=format is given,
this shrinks loaded data of 30% (17MB less on Linux tree) and gives a
good speed up when you are low on memory (especially on big repos)

Next step _would_ be to load log message body on demand (another 50%
reduction) but this has two drawbacks:

(1) Text search/filter on log message would be broken

(2) Slower to browse through revisions because for each revision an
additional git-rev-list /git-log command should be executed to read
the body

The second point is worsted by the fact that it is not possible to
keep a command running and "open" like as example git-diff-tree
--stdin and feed with additional revision's sha when needed. Avoiding
the burden to startup a new process each time to read a new log
message given an sha would let the answer much more quick especially
on lesser OS's

Indeed there is a git-rev-list --stdin option but with different
behaviour from git-diff-tree --stdin and not suitable for this.

Marco

^ permalink raw reply

* Re: [RFC/PATCH] git-help: add new options -w (for web) and -i (for info)
From: Jakub Narebski @ 2007-11-24  8:52 UTC (permalink / raw)
  To: git
In-Reply-To: <20071124051650.07fd275f.chriscool@tuxfamily.org>

[Cc: Christian Couder <chriscool@tuxfamily.org>, git@vger.kernel.org]

Christian Couder wrote:

> This currently works only if the HTML versions of the man page
> have been installed in "PREFIX/share/doc/git-doc", so new target
> to do that is added to "Documentation/Makefile".

git-core RPM (th git one) installs HTML version of manpages to
/usr/share/doc/git-core-$version/

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* [PATCH 1/2] git-gui: Update git-gui.pot with latest (few) string additions and changes.
From: Christian Stimming @ 2007-11-24 10:04 UTC (permalink / raw)
  To: spearce; +Cc: Johannes Schindelin, git

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

---
I've attached this and the following (German translation update) patch as
tarball as well, just in case mailers will mess with whitespaces again.

This is against master of git-gui.git. Alternatively, you can just as well run
"make po/git-gui.pot" and commit the result.

 po/git-gui.pot |  404 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 221 insertions(+), 183 deletions(-)

diff --git a/po/git-gui.pot b/po/git-gui.pot
index 00f0f59..dfa48ae 100644
--- a/po/git-gui.pot
+++ b/po/git-gui.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-10-10 04:04-0400\n"
+"POT-Creation-Date: 2007-11-24 10:36+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,33 +16,33 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: git-gui.sh:41 git-gui.sh:634 git-gui.sh:648 git-gui.sh:661 git-gui.sh:744
-#: git-gui.sh:763
+#: git-gui.sh:41 git-gui.sh:604 git-gui.sh:618 git-gui.sh:631 git-gui.sh:714
+#: git-gui.sh:733
 msgid "git-gui: fatal error"
 msgstr ""
 
-#: git-gui.sh:595
+#: git-gui.sh:565
 #, tcl-format
 msgid "Invalid font specified in %s:"
 msgstr ""
 
-#: git-gui.sh:620
+#: git-gui.sh:590
 msgid "Main Font"
 msgstr ""
 
-#: git-gui.sh:621
+#: git-gui.sh:591
 msgid "Diff/Console Font"
 msgstr ""
 
-#: git-gui.sh:635
+#: git-gui.sh:605
 msgid "Cannot find git in PATH."
 msgstr ""
 
-#: git-gui.sh:662
+#: git-gui.sh:632
 msgid "Cannot parse Git version string:"
 msgstr ""
 
-#: git-gui.sh:680
+#: git-gui.sh:650
 #, tcl-format
 msgid ""
 "Git version cannot be determined.\n"
@@ -54,79 +54,79 @@ msgid ""
 "Assume '%s' is version 1.5.0?\n"
 msgstr ""
 
-#: git-gui.sh:853
+#: git-gui.sh:888
 msgid "Git directory not found:"
 msgstr ""
 
-#: git-gui.sh:860
+#: git-gui.sh:895
 msgid "Cannot move to top of working directory:"
 msgstr ""
 
-#: git-gui.sh:867
+#: git-gui.sh:902
 msgid "Cannot use funny .git directory:"
 msgstr ""
 
-#: git-gui.sh:872
+#: git-gui.sh:907
 msgid "No working directory"
 msgstr ""
 
-#: git-gui.sh:1019
+#: git-gui.sh:1054
 msgid "Refreshing file status..."
 msgstr ""
 
-#: git-gui.sh:1084
+#: git-gui.sh:1119
 msgid "Scanning for modified files ..."
 msgstr ""
 
-#: git-gui.sh:1259 lib/browser.tcl:245
+#: git-gui.sh:1294 lib/browser.tcl:245
 msgid "Ready."
 msgstr ""
 
-#: git-gui.sh:1525
+#: git-gui.sh:1560
 msgid "Unmodified"
 msgstr ""
 
-#: git-gui.sh:1527
+#: git-gui.sh:1562
 msgid "Modified, not staged"
 msgstr ""
 
-#: git-gui.sh:1528 git-gui.sh:1533
+#: git-gui.sh:1563 git-gui.sh:1568
 msgid "Staged for commit"
 msgstr ""
 
-#: git-gui.sh:1529 git-gui.sh:1534
+#: git-gui.sh:1564 git-gui.sh:1569
 msgid "Portions staged for commit"
 msgstr ""
 
-#: git-gui.sh:1530 git-gui.sh:1535
+#: git-gui.sh:1565 git-gui.sh:1570
 msgid "Staged for commit, missing"
 msgstr ""
 
-#: git-gui.sh:1532
+#: git-gui.sh:1567
 msgid "Untracked, not staged"
 msgstr ""
 
-#: git-gui.sh:1537
+#: git-gui.sh:1572
 msgid "Missing"
 msgstr ""
 
-#: git-gui.sh:1538
+#: git-gui.sh:1573
 msgid "Staged for removal"
 msgstr ""
 
-#: git-gui.sh:1539
+#: git-gui.sh:1574
 msgid "Staged for removal, still present"
 msgstr ""
 
-#: git-gui.sh:1541 git-gui.sh:1542 git-gui.sh:1543 git-gui.sh:1544
+#: git-gui.sh:1576 git-gui.sh:1577 git-gui.sh:1578 git-gui.sh:1579
 msgid "Requires merge resolution"
 msgstr ""
 
-#: git-gui.sh:1579
+#: git-gui.sh:1614
 msgid "Starting gitk... please wait..."
 msgstr ""
 
-#: git-gui.sh:1588
+#: git-gui.sh:1623
 #, tcl-format
 msgid ""
 "Unable to start gitk:\n"
@@ -134,295 +134,295 @@ msgid ""
 "%s does not exist"
 msgstr ""
 
-#: git-gui.sh:1788 lib/choose_repository.tcl:32
+#: git-gui.sh:1823 lib/choose_repository.tcl:35
 msgid "Repository"
 msgstr ""
 
-#: git-gui.sh:1789
+#: git-gui.sh:1824
 msgid "Edit"
 msgstr ""
 
-#: git-gui.sh:1791 lib/choose_rev.tcl:560
+#: git-gui.sh:1826 lib/choose_rev.tcl:560
 msgid "Branch"
 msgstr ""
 
-#: git-gui.sh:1794 lib/choose_rev.tcl:547
+#: git-gui.sh:1829 lib/choose_rev.tcl:547
 msgid "Commit@@noun"
 msgstr ""
 
-#: git-gui.sh:1797 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168
+#: git-gui.sh:1832 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168
 msgid "Merge"
 msgstr ""
 
-#: git-gui.sh:1798 lib/choose_rev.tcl:556
+#: git-gui.sh:1833 lib/choose_rev.tcl:556
 msgid "Remote"
 msgstr ""
 
-#: git-gui.sh:1807
+#: git-gui.sh:1842
 msgid "Browse Current Branch's Files"
 msgstr ""
 
-#: git-gui.sh:1811
+#: git-gui.sh:1846
 msgid "Browse Branch Files..."
 msgstr ""
 
-#: git-gui.sh:1816
+#: git-gui.sh:1851
 msgid "Visualize Current Branch's History"
 msgstr ""
 
-#: git-gui.sh:1820
+#: git-gui.sh:1855
 msgid "Visualize All Branch History"
 msgstr ""
 
-#: git-gui.sh:1827
+#: git-gui.sh:1862
 #, tcl-format
 msgid "Browse %s's Files"
 msgstr ""
 
-#: git-gui.sh:1829
+#: git-gui.sh:1864
 #, tcl-format
 msgid "Visualize %s's History"
 msgstr ""
 
-#: git-gui.sh:1834 lib/database.tcl:27 lib/database.tcl:67
+#: git-gui.sh:1869 lib/database.tcl:27 lib/database.tcl:67
 msgid "Database Statistics"
 msgstr ""
 
-#: git-gui.sh:1837 lib/database.tcl:34
+#: git-gui.sh:1872 lib/database.tcl:34
 msgid "Compress Database"
 msgstr ""
 
-#: git-gui.sh:1840
+#: git-gui.sh:1875
 msgid "Verify Database"
 msgstr ""
 
-#: git-gui.sh:1847 git-gui.sh:1851 git-gui.sh:1855 lib/shortcut.tcl:9
-#: lib/shortcut.tcl:45 lib/shortcut.tcl:84
+#: git-gui.sh:1882 git-gui.sh:1886 git-gui.sh:1890 lib/shortcut.tcl:7
+#: lib/shortcut.tcl:39 lib/shortcut.tcl:71
 msgid "Create Desktop Icon"
 msgstr ""
 
-#: git-gui.sh:1860 lib/choose_repository.tcl:36 lib/choose_repository.tcl:95
+#: git-gui.sh:1895 lib/choose_repository.tcl:176 lib/choose_repository.tcl:184
 msgid "Quit"
 msgstr ""
 
-#: git-gui.sh:1867
+#: git-gui.sh:1902
 msgid "Undo"
 msgstr ""
 
-#: git-gui.sh:1870
+#: git-gui.sh:1905
 msgid "Redo"
 msgstr ""
 
-#: git-gui.sh:1874 git-gui.sh:2366
+#: git-gui.sh:1909 git-gui.sh:2403
 msgid "Cut"
 msgstr ""
 
-#: git-gui.sh:1877 git-gui.sh:2369 git-gui.sh:2440 git-gui.sh:2512
+#: git-gui.sh:1912 git-gui.sh:2406 git-gui.sh:2477 git-gui.sh:2549
 #: lib/console.tcl:67
 msgid "Copy"
 msgstr ""
 
-#: git-gui.sh:1880 git-gui.sh:2372
+#: git-gui.sh:1915 git-gui.sh:2409
 msgid "Paste"
 msgstr ""
 
-#: git-gui.sh:1883 git-gui.sh:2375 lib/branch_delete.tcl:26
+#: git-gui.sh:1918 git-gui.sh:2412 lib/branch_delete.tcl:26
 #: lib/remote_branch_delete.tcl:38
 msgid "Delete"
 msgstr ""
 
-#: git-gui.sh:1887 git-gui.sh:2379 git-gui.sh:2516 lib/console.tcl:69
+#: git-gui.sh:1922 git-gui.sh:2416 git-gui.sh:2553 lib/console.tcl:69
 msgid "Select All"
 msgstr ""
 
-#: git-gui.sh:1896
+#: git-gui.sh:1931
 msgid "Create..."
 msgstr ""
 
-#: git-gui.sh:1902
+#: git-gui.sh:1937
 msgid "Checkout..."
 msgstr ""
 
-#: git-gui.sh:1908
+#: git-gui.sh:1943
 msgid "Rename..."
 msgstr ""
 
-#: git-gui.sh:1913 git-gui.sh:2012
+#: git-gui.sh:1948 git-gui.sh:2048
 msgid "Delete..."
 msgstr ""
 
-#: git-gui.sh:1918
+#: git-gui.sh:1953
 msgid "Reset..."
 msgstr ""
 
-#: git-gui.sh:1930 git-gui.sh:2313
+#: git-gui.sh:1965 git-gui.sh:2350
 msgid "New Commit"
 msgstr ""
 
-#: git-gui.sh:1938 git-gui.sh:2320
+#: git-gui.sh:1973 git-gui.sh:2357
 msgid "Amend Last Commit"
 msgstr ""
 
-#: git-gui.sh:1947 git-gui.sh:2280 lib/remote_branch_delete.tcl:99
+#: git-gui.sh:1982 git-gui.sh:2317 lib/remote_branch_delete.tcl:99
 msgid "Rescan"
 msgstr ""
 
-#: git-gui.sh:1953
+#: git-gui.sh:1988
 msgid "Stage To Commit"
 msgstr ""
 
-#: git-gui.sh:1958
+#: git-gui.sh:1994
 msgid "Stage Changed Files To Commit"
 msgstr ""
 
-#: git-gui.sh:1964
+#: git-gui.sh:2000
 msgid "Unstage From Commit"
 msgstr ""
 
-#: git-gui.sh:1969 lib/index.tcl:352
+#: git-gui.sh:2005 lib/index.tcl:393
 msgid "Revert Changes"
 msgstr ""
 
-#: git-gui.sh:1976 git-gui.sh:2292 git-gui.sh:2390
+#: git-gui.sh:2012 git-gui.sh:2329 git-gui.sh:2427
 msgid "Sign Off"
 msgstr ""
 
-#: git-gui.sh:1980 git-gui.sh:2296
+#: git-gui.sh:2016 git-gui.sh:2333
 msgid "Commit@@verb"
 msgstr ""
 
-#: git-gui.sh:1991
+#: git-gui.sh:2027
 msgid "Local Merge..."
 msgstr ""
 
-#: git-gui.sh:1996
+#: git-gui.sh:2032
 msgid "Abort Merge..."
 msgstr ""
 
-#: git-gui.sh:2008
+#: git-gui.sh:2044
 msgid "Push..."
 msgstr ""
 
-#: git-gui.sh:2019 lib/choose_repository.tcl:41
+#: git-gui.sh:2055 lib/choose_repository.tcl:40
 msgid "Apple"
 msgstr ""
 
-#: git-gui.sh:2022 git-gui.sh:2044 lib/about.tcl:13
-#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:50
+#: git-gui.sh:2058 git-gui.sh:2080 lib/about.tcl:13
+#: lib/choose_repository.tcl:43 lib/choose_repository.tcl:49
 #, tcl-format
 msgid "About %s"
 msgstr ""
 
-#: git-gui.sh:2026
+#: git-gui.sh:2062
 msgid "Preferences..."
 msgstr ""
 
-#: git-gui.sh:2034 git-gui.sh:2558
+#: git-gui.sh:2070 git-gui.sh:2595
 msgid "Options..."
 msgstr ""
 
-#: git-gui.sh:2040 lib/choose_repository.tcl:47
+#: git-gui.sh:2076 lib/choose_repository.tcl:46
 msgid "Help"
 msgstr ""
 
-#: git-gui.sh:2081
+#: git-gui.sh:2117
 msgid "Online Documentation"
 msgstr ""
 
-#: git-gui.sh:2165
+#: git-gui.sh:2201
 #, tcl-format
 msgid "fatal: cannot stat path %s: No such file or directory"
 msgstr ""
 
-#: git-gui.sh:2198
+#: git-gui.sh:2234
 msgid "Current Branch:"
 msgstr ""
 
-#: git-gui.sh:2219
+#: git-gui.sh:2255
 msgid "Staged Changes (Will Commit)"
 msgstr ""
 
-#: git-gui.sh:2239
+#: git-gui.sh:2274
 msgid "Unstaged Changes"
 msgstr ""
 
-#: git-gui.sh:2286
+#: git-gui.sh:2323
 msgid "Stage Changed"
 msgstr ""
 
-#: git-gui.sh:2302 lib/transport.tcl:93 lib/transport.tcl:182
+#: git-gui.sh:2339 lib/transport.tcl:93 lib/transport.tcl:182
 msgid "Push"
 msgstr ""
 
-#: git-gui.sh:2332
+#: git-gui.sh:2369
 msgid "Initial Commit Message:"
 msgstr ""
 
-#: git-gui.sh:2333
+#: git-gui.sh:2370
 msgid "Amended Commit Message:"
 msgstr ""
 
-#: git-gui.sh:2334
+#: git-gui.sh:2371
 msgid "Amended Initial Commit Message:"
 msgstr ""
 
-#: git-gui.sh:2335
+#: git-gui.sh:2372
 msgid "Amended Merge Commit Message:"
 msgstr ""
 
-#: git-gui.sh:2336
+#: git-gui.sh:2373
 msgid "Merge Commit Message:"
 msgstr ""
 
-#: git-gui.sh:2337
+#: git-gui.sh:2374
 msgid "Commit Message:"
 msgstr ""
 
-#: git-gui.sh:2382 git-gui.sh:2520 lib/console.tcl:71
+#: git-gui.sh:2419 git-gui.sh:2557 lib/console.tcl:71
 msgid "Copy All"
 msgstr ""
 
-#: git-gui.sh:2406 lib/blame.tcl:104
+#: git-gui.sh:2443 lib/blame.tcl:104
 msgid "File:"
 msgstr ""
 
-#: git-gui.sh:2508
+#: git-gui.sh:2545
 msgid "Refresh"
 msgstr ""
 
-#: git-gui.sh:2529
+#: git-gui.sh:2566
 msgid "Apply/Reverse Hunk"
 msgstr ""
 
-#: git-gui.sh:2535
+#: git-gui.sh:2572
 msgid "Decrease Font Size"
 msgstr ""
 
-#: git-gui.sh:2539
+#: git-gui.sh:2576
 msgid "Increase Font Size"
 msgstr ""
 
-#: git-gui.sh:2544
+#: git-gui.sh:2581
 msgid "Show Less Context"
 msgstr ""
 
-#: git-gui.sh:2551
+#: git-gui.sh:2588
 msgid "Show More Context"
 msgstr ""
 
-#: git-gui.sh:2565
+#: git-gui.sh:2602
 msgid "Unstage Hunk From Commit"
 msgstr ""
 
-#: git-gui.sh:2567
+#: git-gui.sh:2604
 msgid "Stage Hunk For Commit"
 msgstr ""
 
-#: git-gui.sh:2586
+#: git-gui.sh:2623
 msgid "Initializing..."
 msgstr ""
 
-#: git-gui.sh:2677
+#: git-gui.sh:2718
 #, tcl-format
 msgid ""
 "Possible environment issues exist.\n"
@@ -433,14 +433,14 @@ msgid ""
 "\n"
 msgstr ""
 
-#: git-gui.sh:2707
+#: git-gui.sh:2748
 msgid ""
 "\n"
 "This is due to a known issue with the\n"
 "Tcl binary distributed by Cygwin."
 msgstr ""
 
-#: git-gui.sh:2712
+#: git-gui.sh:2753
 #, tcl-format
 msgid ""
 "\n"
@@ -555,7 +555,7 @@ msgstr ""
 msgid "Create New Branch"
 msgstr ""
 
-#: lib/branch_create.tcl:31 lib/choose_repository.tcl:199
+#: lib/branch_create.tcl:31 lib/choose_repository.tcl:375
 msgid "Create"
 msgstr ""
 
@@ -703,9 +703,9 @@ msgstr ""
 msgid "Browse Branch Files"
 msgstr ""
 
-#: lib/browser.tcl:277 lib/choose_repository.tcl:215
-#: lib/choose_repository.tcl:305 lib/choose_repository.tcl:315
-#: lib/choose_repository.tcl:811
+#: lib/browser.tcl:277 lib/choose_repository.tcl:391
+#: lib/choose_repository.tcl:482 lib/choose_repository.tcl:492
+#: lib/choose_repository.tcl:989
 msgid "Browse"
 msgstr ""
 
@@ -844,209 +844,225 @@ msgid ""
 "If you like this text, it can be your font."
 msgstr ""
 
-#: lib/choose_repository.tcl:25
+#: lib/choose_repository.tcl:27
 msgid "Git Gui"
 msgstr ""
 
-#: lib/choose_repository.tcl:69 lib/choose_repository.tcl:204
+#: lib/choose_repository.tcl:80 lib/choose_repository.tcl:380
 msgid "Create New Repository"
 msgstr ""
 
-#: lib/choose_repository.tcl:74 lib/choose_repository.tcl:291
+#: lib/choose_repository.tcl:86
+msgid "New..."
+msgstr ""
+
+#: lib/choose_repository.tcl:93 lib/choose_repository.tcl:468
 msgid "Clone Existing Repository"
 msgstr ""
 
-#: lib/choose_repository.tcl:79 lib/choose_repository.tcl:800
+#: lib/choose_repository.tcl:99
+msgid "Clone..."
+msgstr ""
+
+#: lib/choose_repository.tcl:106 lib/choose_repository.tcl:978
 msgid "Open Existing Repository"
 msgstr ""
 
-#: lib/choose_repository.tcl:91
-msgid "Next >"
+#: lib/choose_repository.tcl:112
+msgid "Open..."
+msgstr ""
+
+#: lib/choose_repository.tcl:125
+msgid "Recent Repositories"
 msgstr ""
 
-#: lib/choose_repository.tcl:152
+#: lib/choose_repository.tcl:131
+msgid "Open Recent Repository:"
+msgstr ""
+
+#: lib/choose_repository.tcl:294
 #, tcl-format
 msgid "Location %s already exists."
 msgstr ""
 
-#: lib/choose_repository.tcl:158 lib/choose_repository.tcl:165
-#: lib/choose_repository.tcl:172
+#: lib/choose_repository.tcl:300 lib/choose_repository.tcl:307
+#: lib/choose_repository.tcl:314
 #, tcl-format
 msgid "Failed to create repository %s:"
 msgstr ""
 
-#: lib/choose_repository.tcl:209 lib/choose_repository.tcl:309
+#: lib/choose_repository.tcl:385 lib/choose_repository.tcl:486
 msgid "Directory:"
 msgstr ""
 
-#: lib/choose_repository.tcl:238 lib/choose_repository.tcl:363
-#: lib/choose_repository.tcl:834
+#: lib/choose_repository.tcl:415 lib/choose_repository.tcl:544
+#: lib/choose_repository.tcl:1013
 msgid "Git Repository"
 msgstr ""
 
-#: lib/choose_repository.tcl:253 lib/choose_repository.tcl:260
+#: lib/choose_repository.tcl:430 lib/choose_repository.tcl:437
 #, tcl-format
 msgid "Directory %s already exists."
 msgstr ""
 
-#: lib/choose_repository.tcl:265
+#: lib/choose_repository.tcl:442
 #, tcl-format
 msgid "File %s already exists."
 msgstr ""
 
-#: lib/choose_repository.tcl:286
+#: lib/choose_repository.tcl:463
 msgid "Clone"
 msgstr ""
 
-#: lib/choose_repository.tcl:299
+#: lib/choose_repository.tcl:476
 msgid "URL:"
 msgstr ""
 
-#: lib/choose_repository.tcl:319
+#: lib/choose_repository.tcl:496
 msgid "Clone Type:"
 msgstr ""
 
-#: lib/choose_repository.tcl:325
+#: lib/choose_repository.tcl:502
 msgid "Standard (Fast, Semi-Redundant, Hardlinks)"
 msgstr ""
 
-#: lib/choose_repository.tcl:331
+#: lib/choose_repository.tcl:508
 msgid "Full Copy (Slower, Redundant Backup)"
 msgstr ""
 
-#: lib/choose_repository.tcl:337
+#: lib/choose_repository.tcl:514
 msgid "Shared (Fastest, Not Recommended, No Backup)"
 msgstr ""
 
-#: lib/choose_repository.tcl:369 lib/choose_repository.tcl:418
-#: lib/choose_repository.tcl:560 lib/choose_repository.tcl:630
-#: lib/choose_repository.tcl:840 lib/choose_repository.tcl:848
+#: lib/choose_repository.tcl:550 lib/choose_repository.tcl:597
+#: lib/choose_repository.tcl:738 lib/choose_repository.tcl:808
+#: lib/choose_repository.tcl:1019 lib/choose_repository.tcl:1027
 #, tcl-format
 msgid "Not a Git repository: %s"
 msgstr ""
 
-#: lib/choose_repository.tcl:405
+#: lib/choose_repository.tcl:586
 msgid "Standard only available for local repository."
 msgstr ""
 
-#: lib/choose_repository.tcl:409
+#: lib/choose_repository.tcl:590
 msgid "Shared only available for local repository."
 msgstr ""
 
-#: lib/choose_repository.tcl:439
+#: lib/choose_repository.tcl:617
 msgid "Failed to configure origin"
 msgstr ""
 
-#: lib/choose_repository.tcl:451
+#: lib/choose_repository.tcl:629
 msgid "Counting objects"
 msgstr ""
 
-#: lib/choose_repository.tcl:452
+#: lib/choose_repository.tcl:630
 msgid "buckets"
 msgstr ""
 
-#: lib/choose_repository.tcl:476
+#: lib/choose_repository.tcl:654
 #, tcl-format
 msgid "Unable to copy objects/info/alternates: %s"
 msgstr ""
 
-#: lib/choose_repository.tcl:512
+#: lib/choose_repository.tcl:690
 #, tcl-format
 msgid "Nothing to clone from %s."
 msgstr ""
 
-#: lib/choose_repository.tcl:514 lib/choose_repository.tcl:728
-#: lib/choose_repository.tcl:740
+#: lib/choose_repository.tcl:692 lib/choose_repository.tcl:906
+#: lib/choose_repository.tcl:918
 msgid "The 'master' branch has not been initialized."
 msgstr ""
 
-#: lib/choose_repository.tcl:527
+#: lib/choose_repository.tcl:705
 msgid "Hardlinks are unavailable.  Falling back to copying."
 msgstr ""
 
-#: lib/choose_repository.tcl:539
+#: lib/choose_repository.tcl:717
 #, tcl-format
 msgid "Cloning from %s"
 msgstr ""
 
-#: lib/choose_repository.tcl:570
+#: lib/choose_repository.tcl:748
 msgid "Copying objects"
 msgstr ""
 
-#: lib/choose_repository.tcl:571
+#: lib/choose_repository.tcl:749
 msgid "KiB"
 msgstr ""
 
-#: lib/choose_repository.tcl:595
+#: lib/choose_repository.tcl:773
 #, tcl-format
 msgid "Unable to copy object: %s"
 msgstr ""
 
-#: lib/choose_repository.tcl:605
+#: lib/choose_repository.tcl:783
 msgid "Linking objects"
 msgstr ""
 
-#: lib/choose_repository.tcl:606
+#: lib/choose_repository.tcl:784
 msgid "objects"
 msgstr ""
 
-#: lib/choose_repository.tcl:614
+#: lib/choose_repository.tcl:792
 #, tcl-format
 msgid "Unable to hardlink object: %s"
 msgstr ""
 
-#: lib/choose_repository.tcl:669
+#: lib/choose_repository.tcl:847
 msgid "Cannot fetch branches and objects.  See console output for details."
 msgstr ""
 
-#: lib/choose_repository.tcl:680
+#: lib/choose_repository.tcl:858
 msgid "Cannot fetch tags.  See console output for details."
 msgstr ""
 
-#: lib/choose_repository.tcl:704
+#: lib/choose_repository.tcl:882
 msgid "Cannot determine HEAD.  See console output for details."
 msgstr ""
 
-#: lib/choose_repository.tcl:713
+#: lib/choose_repository.tcl:891
 #, tcl-format
 msgid "Unable to cleanup %s"
 msgstr ""
 
-#: lib/choose_repository.tcl:719
+#: lib/choose_repository.tcl:897
 msgid "Clone failed."
 msgstr ""
 
-#: lib/choose_repository.tcl:726
+#: lib/choose_repository.tcl:904
 msgid "No default branch obtained."
 msgstr ""
 
-#: lib/choose_repository.tcl:737
+#: lib/choose_repository.tcl:915
 #, tcl-format
 msgid "Cannot resolve %s as a commit."
 msgstr ""
 
-#: lib/choose_repository.tcl:749
+#: lib/choose_repository.tcl:927
 msgid "Creating working directory"
 msgstr ""
 
-#: lib/choose_repository.tcl:750 lib/index.tcl:15 lib/index.tcl:80
-#: lib/index.tcl:149
+#: lib/choose_repository.tcl:928 lib/index.tcl:65 lib/index.tcl:127
+#: lib/index.tcl:193
 msgid "files"
 msgstr ""
 
-#: lib/choose_repository.tcl:779
+#: lib/choose_repository.tcl:957
 msgid "Initial file checkout failed."
 msgstr ""
 
-#: lib/choose_repository.tcl:795
+#: lib/choose_repository.tcl:973
 msgid "Open"
 msgstr ""
 
-#: lib/choose_repository.tcl:805
+#: lib/choose_repository.tcl:983
 msgid "Repository:"
 msgstr ""
 
-#: lib/choose_repository.tcl:854
+#: lib/choose_repository.tcl:1033
 #, tcl-format
 msgid "Failed to open repository %s:"
 msgstr ""
@@ -1161,7 +1177,7 @@ msgid ""
 "\n"
 "A good commit message has the following format:\n"
 "\n"
-"- First line: Describe in one sentance what you did.\n"
+"- First line: Describe in one sentence what you did.\n"
 "- Second line: Blank\n"
 "- Remaining lines: Describe why this change is good.\n"
 msgstr ""
@@ -1330,31 +1346,53 @@ msgstr ""
 msgid "You must correct the above errors before committing."
 msgstr ""
 
-#: lib/index.tcl:241
+#: lib/index.tcl:6
+msgid "Unable to unlock the index."
+msgstr ""
+
+#: lib/index.tcl:15
+msgid "Index Error"
+msgstr ""
+
+#: lib/index.tcl:21
+msgid ""
+"Updating the Git index failed.  A rescan will be automatically started to "
+"resynchronize git-gui."
+msgstr ""
+
+#: lib/index.tcl:27
+msgid "Continue"
+msgstr ""
+
+#: lib/index.tcl:31
+msgid "Unlock Index"
+msgstr ""
+
+#: lib/index.tcl:282
 #, tcl-format
 msgid "Unstaging %s from commit"
 msgstr ""
 
-#: lib/index.tcl:285
+#: lib/index.tcl:326
 #, tcl-format
 msgid "Adding %s"
 msgstr ""
 
-#: lib/index.tcl:340
+#: lib/index.tcl:381
 #, tcl-format
 msgid "Revert changes in file %s?"
 msgstr ""
 
-#: lib/index.tcl:342
+#: lib/index.tcl:383
 #, tcl-format
 msgid "Revert changes in these %i files?"
 msgstr ""
 
-#: lib/index.tcl:348
+#: lib/index.tcl:389
 msgid "Any unstaged changes will be permanently lost by the revert."
 msgstr ""
 
-#: lib/index.tcl:351
+#: lib/index.tcl:392
 msgid "Do Nothing"
 msgstr ""
 
@@ -1539,18 +1577,6 @@ msgstr ""
 msgid "Failed to completely save options:"
 msgstr ""
 
-#: lib/remote.tcl:165
-msgid "Prune from"
-msgstr ""
-
-#: lib/remote.tcl:170
-msgid "Fetch from"
-msgstr ""
-
-#: lib/remote.tcl:213
-msgid "Push to"
-msgstr ""
-
 #: lib/remote_branch_delete.tcl:29 lib/remote_branch_delete.tcl:34
 msgid "Delete Remote Branch"
 msgstr ""
@@ -1627,11 +1653,23 @@ msgstr ""
 msgid "Scanning %s..."
 msgstr ""
 
-#: lib/shortcut.tcl:26 lib/shortcut.tcl:74
-msgid "Cannot write script:"
+#: lib/remote.tcl:165
+msgid "Prune from"
+msgstr ""
+
+#: lib/remote.tcl:170
+msgid "Fetch from"
+msgstr ""
+
+#: lib/remote.tcl:213
+msgid "Push to"
+msgstr ""
+
+#: lib/shortcut.tcl:20 lib/shortcut.tcl:61
+msgid "Cannot write shortcut:"
 msgstr ""
 
-#: lib/shortcut.tcl:149
+#: lib/shortcut.tcl:136
 msgid "Cannot write icon:"
 msgstr ""
 
-- 
1.5.3.4.206.g58ba4


[-- Attachment #2: git-gui_i18n.tar.gz --]
[-- Type: application/x-tgz, Size: 8799 bytes --]

^ permalink raw reply related

* [PATCH 2/2] git-gui: Update German translation. 100% completed.
From: Christian Stimming @ 2007-11-24 10:05 UTC (permalink / raw)
  To: spearce; +Cc: Johannes Schindelin, git
In-Reply-To: <200711241104.32371.stimming@tuhh.de>

---
 po/de.po |  308 +++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 167 insertions(+), 141 deletions(-)

diff --git a/po/de.po b/po/de.po
index 3df30ed..ac8ae0a 100644
--- a/po/de.po
+++ b/po/de.po
@@ -7,41 +7,41 @@ msgid ""
 msgstr ""
 "Project-Id-Version: git-gui\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-10-19 21:10+0200\n"
-"PO-Revision-Date: 2007-10-20 15:28+0200\n"
+"POT-Creation-Date: 2007-11-24 10:36+0100\n"
+"PO-Revision-Date: 2007-11-24 10:55+0100\n"
 "Last-Translator: Christian Stimming <stimming@tuhh.de>\n"
 "Language-Team: German\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: git-gui.sh:41 git-gui.sh:590 git-gui.sh:604 git-gui.sh:617 git-gui.sh:700
-#: git-gui.sh:719
+#: git-gui.sh:41 git-gui.sh:604 git-gui.sh:618 git-gui.sh:631 git-gui.sh:714
+#: git-gui.sh:733
 msgid "git-gui: fatal error"
 msgstr "git-gui: Programmfehler"
 
-#: git-gui.sh:551
+#: git-gui.sh:565
 #, tcl-format
 msgid "Invalid font specified in %s:"
 msgstr "Ungültige Zeichensatz-Angabe in %s:"
 
-#: git-gui.sh:576
+#: git-gui.sh:590
 msgid "Main Font"
 msgstr "Programmschriftart"
 
-#: git-gui.sh:577
+#: git-gui.sh:591
 msgid "Diff/Console Font"
 msgstr "Vergleich-Schriftart"
 
-#: git-gui.sh:591
+#: git-gui.sh:605
 msgid "Cannot find git in PATH."
 msgstr "Git kann im PATH nicht gefunden werden."
 
-#: git-gui.sh:618
+#: git-gui.sh:632
 msgid "Cannot parse Git version string:"
 msgstr "Git Versionsangabe kann nicht erkannt werden:"
 
-#: git-gui.sh:636
+#: git-gui.sh:650
 #, tcl-format
 msgid ""
 "Git version cannot be determined.\n"
@@ -60,81 +60,81 @@ msgstr ""
 "\n"
 "Soll angenommen werden, »%s« sei Version 1.5.0?\n"
 
-#: git-gui.sh:874
+#: git-gui.sh:888
 msgid "Git directory not found:"
 msgstr "Git-Verzeichnis nicht gefunden:"
 
-#: git-gui.sh:881
+#: git-gui.sh:895
 msgid "Cannot move to top of working directory:"
 msgstr ""
 "Es konnte nicht in das oberste Verzeichnis der Arbeitskopie gewechselt "
 "werden:"
 
-#: git-gui.sh:888
+#: git-gui.sh:902
 msgid "Cannot use funny .git directory:"
 msgstr "Unerwartete Struktur des .git Verzeichnis:"
 
-#: git-gui.sh:893
+#: git-gui.sh:907
 msgid "No working directory"
 msgstr "Kein Arbeitsverzeichnis"
 
-#: git-gui.sh:1040
+#: git-gui.sh:1054
 msgid "Refreshing file status..."
 msgstr "Dateistatus aktualisieren..."
 
-#: git-gui.sh:1105
+#: git-gui.sh:1119
 msgid "Scanning for modified files ..."
 msgstr "Nach geänderten Dateien suchen..."
 
-#: git-gui.sh:1280 lib/browser.tcl:245
+#: git-gui.sh:1294 lib/browser.tcl:245
 msgid "Ready."
 msgstr "Bereit."
 
-#: git-gui.sh:1546
+#: git-gui.sh:1560
 msgid "Unmodified"
 msgstr "Unverändert"
 
-#: git-gui.sh:1548
+#: git-gui.sh:1562
 msgid "Modified, not staged"
 msgstr "Verändert, nicht bereitgestellt"
 
-#: git-gui.sh:1549 git-gui.sh:1554
+#: git-gui.sh:1563 git-gui.sh:1568
 msgid "Staged for commit"
 msgstr "Bereitgestellt zum Eintragen"
 
-#: git-gui.sh:1550 git-gui.sh:1555
+#: git-gui.sh:1564 git-gui.sh:1569
 msgid "Portions staged for commit"
 msgstr "Teilweise bereitgestellt zum Eintragen"
 
-#: git-gui.sh:1551 git-gui.sh:1556
+#: git-gui.sh:1565 git-gui.sh:1570
 msgid "Staged for commit, missing"
 msgstr "Bereitgestellt zum Eintragen, fehlend"
 
-#: git-gui.sh:1553
+#: git-gui.sh:1567
 msgid "Untracked, not staged"
 msgstr "Nicht unter Versionskontrolle, nicht bereitgestellt"
 
-#: git-gui.sh:1558
+#: git-gui.sh:1572
 msgid "Missing"
 msgstr "Fehlend"
 
-#: git-gui.sh:1559
+#: git-gui.sh:1573
 msgid "Staged for removal"
 msgstr "Bereitgestellt zum Löschen"
 
-#: git-gui.sh:1560
+#: git-gui.sh:1574
 msgid "Staged for removal, still present"
 msgstr "Bereitgestellt zum Löschen, trotzdem vorhanden"
 
-#: git-gui.sh:1562 git-gui.sh:1563 git-gui.sh:1564 git-gui.sh:1565
+#: git-gui.sh:1576 git-gui.sh:1577 git-gui.sh:1578 git-gui.sh:1579
 msgid "Requires merge resolution"
 msgstr "Konfliktauflösung nötig"
 
-#: git-gui.sh:1600
+#: git-gui.sh:1614
 msgid "Starting gitk... please wait..."
 msgstr "Gitk wird gestartet... bitte warten."
 
-#: git-gui.sh:1609
+#: git-gui.sh:1623
 #, tcl-format
 msgid ""
 "Unable to start gitk:\n"
@@ -145,295 +145,295 @@ msgstr ""
 "\n"
 "%s existiert nicht"
 
-#: git-gui.sh:1809 lib/choose_repository.tcl:35
+#: git-gui.sh:1823 lib/choose_repository.tcl:35
 msgid "Repository"
 msgstr "Projektarchiv"
 
-#: git-gui.sh:1810
+#: git-gui.sh:1824
 msgid "Edit"
 msgstr "Bearbeiten"
 
-#: git-gui.sh:1812 lib/choose_rev.tcl:560
+#: git-gui.sh:1826 lib/choose_rev.tcl:560
 msgid "Branch"
 msgstr "Zweig"
 
-#: git-gui.sh:1815 lib/choose_rev.tcl:547
+#: git-gui.sh:1829 lib/choose_rev.tcl:547
 msgid "Commit@@noun"
 msgstr "Version"
 
-#: git-gui.sh:1818 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168
+#: git-gui.sh:1832 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168
 msgid "Merge"
 msgstr "Zusammenführen"
 
-#: git-gui.sh:1819 lib/choose_rev.tcl:556
+#: git-gui.sh:1833 lib/choose_rev.tcl:556
 msgid "Remote"
 msgstr "Andere Archive"
 
-#: git-gui.sh:1828
+#: git-gui.sh:1842
 msgid "Browse Current Branch's Files"
 msgstr "Aktuellen Zweig durchblättern"
 
-#: git-gui.sh:1832
+#: git-gui.sh:1846
 msgid "Browse Branch Files..."
 msgstr "Einen Zweig durchblättern..."
 
-#: git-gui.sh:1837
+#: git-gui.sh:1851
 msgid "Visualize Current Branch's History"
 msgstr "Aktuellen Zweig darstellen"
 
-#: git-gui.sh:1841
+#: git-gui.sh:1855
 msgid "Visualize All Branch History"
 msgstr "Alle Zweige darstellen"
 
-#: git-gui.sh:1848
+#: git-gui.sh:1862
 #, tcl-format
 msgid "Browse %s's Files"
 msgstr "Zweig »%s« durchblättern"
 
-#: git-gui.sh:1850
+#: git-gui.sh:1864
 #, tcl-format
 msgid "Visualize %s's History"
 msgstr "Historie von »%s« darstellen"
 
-#: git-gui.sh:1855 lib/database.tcl:27 lib/database.tcl:67
+#: git-gui.sh:1869 lib/database.tcl:27 lib/database.tcl:67
 msgid "Database Statistics"
 msgstr "Datenbankstatistik"
 
-#: git-gui.sh:1858 lib/database.tcl:34
+#: git-gui.sh:1872 lib/database.tcl:34
 msgid "Compress Database"
 msgstr "Datenbank komprimieren"
 
-#: git-gui.sh:1861
+#: git-gui.sh:1875
 msgid "Verify Database"
 msgstr "Datenbank überprüfen"
 
-#: git-gui.sh:1868 git-gui.sh:1872 git-gui.sh:1876 lib/shortcut.tcl:7
+#: git-gui.sh:1882 git-gui.sh:1886 git-gui.sh:1890 lib/shortcut.tcl:7
 #: lib/shortcut.tcl:39 lib/shortcut.tcl:71
 msgid "Create Desktop Icon"
 msgstr "Desktop-Icon erstellen"
 
-#: git-gui.sh:1881 lib/choose_repository.tcl:176 lib/choose_repository.tcl:184
+#: git-gui.sh:1895 lib/choose_repository.tcl:176 lib/choose_repository.tcl:184
 msgid "Quit"
 msgstr "Beenden"
 
-#: git-gui.sh:1888
+#: git-gui.sh:1902
 msgid "Undo"
 msgstr "Rückgängig"
 
-#: git-gui.sh:1891
+#: git-gui.sh:1905
 msgid "Redo"
 msgstr "Wiederholen"
 
-#: git-gui.sh:1895 git-gui.sh:2388
+#: git-gui.sh:1909 git-gui.sh:2403
 msgid "Cut"
 msgstr "Ausschneiden"
 
-#: git-gui.sh:1898 git-gui.sh:2391 git-gui.sh:2462 git-gui.sh:2534
+#: git-gui.sh:1912 git-gui.sh:2406 git-gui.sh:2477 git-gui.sh:2549
 #: lib/console.tcl:67
 msgid "Copy"
 msgstr "Kopieren"
 
-#: git-gui.sh:1901 git-gui.sh:2394
+#: git-gui.sh:1915 git-gui.sh:2409
 msgid "Paste"
 msgstr "Einfügen"
 
-#: git-gui.sh:1904 git-gui.sh:2397 lib/branch_delete.tcl:26
+#: git-gui.sh:1918 git-gui.sh:2412 lib/branch_delete.tcl:26
 #: lib/remote_branch_delete.tcl:38
 msgid "Delete"
 msgstr "Löschen"
 
-#: git-gui.sh:1908 git-gui.sh:2401 git-gui.sh:2538 lib/console.tcl:69
+#: git-gui.sh:1922 git-gui.sh:2416 git-gui.sh:2553 lib/console.tcl:69
 msgid "Select All"
 msgstr "Alle auswählen"
 
-#: git-gui.sh:1917
+#: git-gui.sh:1931
 msgid "Create..."
 msgstr "Erstellen..."
 
-#: git-gui.sh:1923
+#: git-gui.sh:1937
 msgid "Checkout..."
 msgstr "Umstellen..."
 
-#: git-gui.sh:1929
+#: git-gui.sh:1943
 msgid "Rename..."
 msgstr "Umbenennen..."
 
-#: git-gui.sh:1934 git-gui.sh:2033
+#: git-gui.sh:1948 git-gui.sh:2048
 msgid "Delete..."
 msgstr "Löschen..."
 
-#: git-gui.sh:1939
+#: git-gui.sh:1953
 msgid "Reset..."
 msgstr "Zurücksetzen..."
 
-#: git-gui.sh:1951 git-gui.sh:2335
+#: git-gui.sh:1965 git-gui.sh:2350
 msgid "New Commit"
 msgstr "Neue Version"
 
-#: git-gui.sh:1959 git-gui.sh:2342
+#: git-gui.sh:1973 git-gui.sh:2357
 msgid "Amend Last Commit"
 msgstr "Letzte Version nachbessern"
 
-#: git-gui.sh:1968 git-gui.sh:2302 lib/remote_branch_delete.tcl:99
+#: git-gui.sh:1982 git-gui.sh:2317 lib/remote_branch_delete.tcl:99
 msgid "Rescan"
 msgstr "Neu laden"
 
-#: git-gui.sh:1974
+#: git-gui.sh:1988
 msgid "Stage To Commit"
 msgstr "Zum Eintragen bereitstellen"
 
-#: git-gui.sh:1979
+#: git-gui.sh:1994
 msgid "Stage Changed Files To Commit"
 msgstr "Geänderte Dateien zum Eintragen bereitstellen"
 
-#: git-gui.sh:1985
+#: git-gui.sh:2000
 msgid "Unstage From Commit"
 msgstr "Aus der Bereitstellung herausnehmen"
 
-#: git-gui.sh:1990 lib/index.tcl:352
+#: git-gui.sh:2005 lib/index.tcl:393
 msgid "Revert Changes"
 msgstr "Änderungen revidieren"
 
-#: git-gui.sh:1997 git-gui.sh:2314 git-gui.sh:2412
+#: git-gui.sh:2012 git-gui.sh:2329 git-gui.sh:2427
 msgid "Sign Off"
 msgstr "Abzeichnen"
 
-#: git-gui.sh:2001 git-gui.sh:2318
+#: git-gui.sh:2016 git-gui.sh:2333
 msgid "Commit@@verb"
 msgstr "Eintragen"
 
-#: git-gui.sh:2012
+#: git-gui.sh:2027
 msgid "Local Merge..."
 msgstr "Lokales Zusammenführen..."
 
-#: git-gui.sh:2017
+#: git-gui.sh:2032
 msgid "Abort Merge..."
 msgstr "Zusammenführen abbrechen..."
 
-#: git-gui.sh:2029
+#: git-gui.sh:2044
 msgid "Push..."
 msgstr "Versenden..."
 
-#: git-gui.sh:2040 lib/choose_repository.tcl:40
+#: git-gui.sh:2055 lib/choose_repository.tcl:40
 msgid "Apple"
 msgstr "Apple"
 
-#: git-gui.sh:2043 git-gui.sh:2065 lib/about.tcl:13
+#: git-gui.sh:2058 git-gui.sh:2080 lib/about.tcl:13
 #: lib/choose_repository.tcl:43 lib/choose_repository.tcl:49
 #, tcl-format
 msgid "About %s"
 msgstr "Über %s"
 
-#: git-gui.sh:2047
+#: git-gui.sh:2062
 msgid "Preferences..."
 msgstr "Einstellungen..."
 
-#: git-gui.sh:2055 git-gui.sh:2580
+#: git-gui.sh:2070 git-gui.sh:2595
 msgid "Options..."
 msgstr "Optionen..."
 
-#: git-gui.sh:2061 lib/choose_repository.tcl:46
+#: git-gui.sh:2076 lib/choose_repository.tcl:46
 msgid "Help"
 msgstr "Hilfe"
 
-#: git-gui.sh:2102
+#: git-gui.sh:2117
 msgid "Online Documentation"
 msgstr "Online-Dokumentation"
 
-#: git-gui.sh:2186
+#: git-gui.sh:2201
 #, tcl-format
 msgid "fatal: cannot stat path %s: No such file or directory"
-msgstr ""
+msgstr "Fehler: Verzeichnis »%s« kann nicht gelesen werden: Datei oder Verzeichnis nicht gefunden"
 
-#: git-gui.sh:2219
+#: git-gui.sh:2234
 msgid "Current Branch:"
 msgstr "Aktueller Zweig:"
 
-#: git-gui.sh:2240
+#: git-gui.sh:2255
 msgid "Staged Changes (Will Commit)"
 msgstr "Bereitgestellte Änderungen (zum Eintragen)"
 
-#: git-gui.sh:2259
+#: git-gui.sh:2274
 msgid "Unstaged Changes"
 msgstr "Nicht bereitgestellte Änderungen"
 
-#: git-gui.sh:2308
+#: git-gui.sh:2323
 msgid "Stage Changed"
 msgstr "Alles bereitstellen"
 
-#: git-gui.sh:2324 lib/transport.tcl:93 lib/transport.tcl:182
+#: git-gui.sh:2339 lib/transport.tcl:93 lib/transport.tcl:182
 msgid "Push"
 msgstr "Versenden"
 
-#: git-gui.sh:2354
+#: git-gui.sh:2369
 msgid "Initial Commit Message:"
 msgstr "Erste Versionsbeschreibung:"
 
-#: git-gui.sh:2355
+#: git-gui.sh:2370
 msgid "Amended Commit Message:"
 msgstr "Nachgebesserte Versionsbeschreibung:"
 
-#: git-gui.sh:2356
+#: git-gui.sh:2371
 msgid "Amended Initial Commit Message:"
 msgstr "Nachgebesserte erste Versionsbeschreibung:"
 
-#: git-gui.sh:2357
+#: git-gui.sh:2372
 msgid "Amended Merge Commit Message:"
 msgstr "Nachgebesserte Zusammenführungs-Versionsbeschreibung:"
 
-#: git-gui.sh:2358
+#: git-gui.sh:2373
 msgid "Merge Commit Message:"
 msgstr "Zusammenführungs-Versionsbeschreibung:"
 
-#: git-gui.sh:2359
+#: git-gui.sh:2374
 msgid "Commit Message:"
 msgstr "Versionsbeschreibung:"
 
-#: git-gui.sh:2404 git-gui.sh:2542 lib/console.tcl:71
+#: git-gui.sh:2419 git-gui.sh:2557 lib/console.tcl:71
 msgid "Copy All"
 msgstr "Alle kopieren"
 
-#: git-gui.sh:2428 lib/blame.tcl:104
+#: git-gui.sh:2443 lib/blame.tcl:104
 msgid "File:"
 msgstr "Datei:"
 
-#: git-gui.sh:2530
+#: git-gui.sh:2545
 msgid "Refresh"
 msgstr "Aktualisieren"
 
-#: git-gui.sh:2551
+#: git-gui.sh:2566
 msgid "Apply/Reverse Hunk"
 msgstr "Änderung anwenden/umkehren"
 
-#: git-gui.sh:2557
+#: git-gui.sh:2572
 msgid "Decrease Font Size"
 msgstr "Schriftgröße verkleinern"
 
-#: git-gui.sh:2561
+#: git-gui.sh:2576
 msgid "Increase Font Size"
 msgstr "Schriftgröße vergrößern"
 
-#: git-gui.sh:2566
+#: git-gui.sh:2581
 msgid "Show Less Context"
 msgstr "Weniger Kontext anzeigen"
 
-#: git-gui.sh:2573
+#: git-gui.sh:2588
 msgid "Show More Context"
 msgstr "Mehr Kontext anzeigen"
 
-#: git-gui.sh:2587
+#: git-gui.sh:2602
 msgid "Unstage Hunk From Commit"
 msgstr "Aus der Bereitstellung herausnehmen"
 
-#: git-gui.sh:2589
+#: git-gui.sh:2604
 msgid "Stage Hunk For Commit"
 msgstr "In die Bereitstellung hinzufügen"
 
-#: git-gui.sh:2608
+#: git-gui.sh:2623
 msgid "Initializing..."
 msgstr "Initialisieren..."
 
-#: git-gui.sh:2699
+#: git-gui.sh:2718
 #, tcl-format
 msgid ""
 "Possible environment issues exist.\n"
@@ -443,15 +443,23 @@ msgid ""
 "by %s:\n"
 "\n"
 msgstr ""
+"Möglicherweise gibt es Probleme mit manchen Umgebungsvariablen.\n"
+"\n"
+"Die folgenden Umgebungsvariablen können vermutlich nicht \n"
+"von %s an Git weitergegeben werden:\n"
+"\n"
 
-#: git-gui.sh:2729
+#: git-gui.sh:2748
 msgid ""
 "\n"
 "This is due to a known issue with the\n"
 "Tcl binary distributed by Cygwin."
 msgstr ""
+"\n"
+"Dies ist ein bekanntes Problem der Tcl-Version, die\n"
+"in Cygwin mitgeliefert wird."
 
-#: git-gui.sh:2734
+#: git-gui.sh:2753
 #, tcl-format
 msgid ""
 "\n"
@@ -461,6 +469,11 @@ msgid ""
 "user.email settings into your personal\n"
 "~/.gitconfig file.\n"
 msgstr ""
+"\n"
+"\n"
+"Um den Namen »%s« zu ändern, sollten Sie die \n"
+"gewünschten Werte für die Einstellung user.name und \n"
+"user.email in Ihre Datei ~/.gitconfig einfügen.\n"
 
 #: lib/about.tcl:25
 msgid "git-gui - a graphical user interface for Git."
@@ -485,19 +498,19 @@ msgstr "%s lesen..."
 
 #: lib/blame.tcl:473
 msgid "Loading copy/move tracking annotations..."
-msgstr ""
+msgstr "Annotierungen für Kopieren/Verschieben werden geladen..."
 
 #: lib/blame.tcl:493
 msgid "lines annotated"
-msgstr ""
+msgstr "Zeilen annotiert"
 
 #: lib/blame.tcl:674
 msgid "Loading original location annotations..."
-msgstr ""
+msgstr "Annotierungen für ursprünglichen Ort werden geladen..."
 
 #: lib/blame.tcl:677
 msgid "Annotation complete."
-msgstr ""
+msgstr "Annotierung vollständig."
 
 #: lib/blame.tcl:731
 msgid "Loading annotation..."
@@ -733,7 +746,7 @@ msgstr "Änderungen »%s« von »%s« anfordern"
 #: lib/checkout_op.tcl:127
 #, tcl-format
 msgid "fatal: Cannot resolve %s"
-msgstr ""
+msgstr "Fehler: »%s« kann nicht als Zweig oder Version erkannt werden"
 
 #: lib/checkout_op.tcl:140 lib/console.tcl:79 lib/database.tcl:31
 msgid "Close"
@@ -994,20 +1007,20 @@ msgstr "Verknüpft ist nur für lokale Projektarchive verfügbar."
 
 #: lib/choose_repository.tcl:617
 msgid "Failed to configure origin"
-msgstr ""
+msgstr "Der Ursprungsort konnte nicht eingerichtet werden"
 
 #: lib/choose_repository.tcl:629
 msgid "Counting objects"
-msgstr ""
+msgstr "Objekte werden gezählt"
 
 #: lib/choose_repository.tcl:630
 msgid "buckets"
-msgstr ""
+msgstr "Buckets"
 
 #: lib/choose_repository.tcl:654
 #, tcl-format
 msgid "Unable to copy objects/info/alternates: %s"
-msgstr ""
+msgstr "Kopien von Objekten/Info/Alternates konnten nicht erstellt werden: %s"
 
 #: lib/choose_repository.tcl:690
 #, tcl-format
@@ -1017,11 +1030,11 @@ msgstr "Von »%s« konnte nichts kopiert werden."
 #: lib/choose_repository.tcl:692 lib/choose_repository.tcl:906
 #: lib/choose_repository.tcl:918
 msgid "The 'master' branch has not been initialized."
-msgstr ""
+msgstr "Der »master«-Zweig wurde noch nicht initialisiert."
 
 #: lib/choose_repository.tcl:705
 msgid "Hardlinks are unavailable.  Falling back to copying."
-msgstr ""
+msgstr "Hardlinks nicht verfügbar. Stattdessen wird kopiert."
 
 #: lib/choose_repository.tcl:717
 #, tcl-format
@@ -1052,24 +1065,24 @@ msgstr "Objekte"
 #: lib/choose_repository.tcl:792
 #, tcl-format
 msgid "Unable to hardlink object: %s"
-msgstr "Objekt kann nicht hartverlinkt werden: %s"
+msgstr "Für Objekt konnte kein Hardlink erstellt werden: %s"
 
 #: lib/choose_repository.tcl:847
 msgid "Cannot fetch branches and objects.  See console output for details."
-msgstr ""
+msgstr "Zweige und Objekte konnten nicht angefordert werden.  Kontrollieren Sie die Ausgaben auf der Konsole für weitere Angaben."
 
 #: lib/choose_repository.tcl:858
 msgid "Cannot fetch tags.  See console output for details."
-msgstr ""
+msgstr "Markierungen konnten nicht angefordert werden.  Kontrollieren Sie die Ausgaben auf der Konsole für weitere Angaben."
 
 #: lib/choose_repository.tcl:882
 msgid "Cannot determine HEAD.  See console output for details."
-msgstr ""
+msgstr "Die Zweigspitze (HEAD) konnte nicht gefunden werden.  Kontrollieren Sie die Ausgaben auf der Konsole für weitere Angaben."
 
 #: lib/choose_repository.tcl:891
 #, tcl-format
 msgid "Unable to cleanup %s"
-msgstr ""
+msgstr "Verzeichnis »%s« kann nicht aufgeräumt werden."
 
 #: lib/choose_repository.tcl:897
 msgid "Clone failed."
@@ -1077,25 +1090,25 @@ msgstr "Kopieren fehlgeschlagen."
 
 #: lib/choose_repository.tcl:904
 msgid "No default branch obtained."
-msgstr ""
+msgstr "Kein voreingestellter Zweig gefunden."
 
 #: lib/choose_repository.tcl:915
 #, tcl-format
 msgid "Cannot resolve %s as a commit."
-msgstr ""
+msgstr "»%s« wurde nicht als Version gefunden."
 
 #: lib/choose_repository.tcl:927
 msgid "Creating working directory"
 msgstr "Arbeitskopie erstellen"
 
-#: lib/choose_repository.tcl:928 lib/index.tcl:15 lib/index.tcl:80
-#: lib/index.tcl:149
+#: lib/choose_repository.tcl:928 lib/index.tcl:65 lib/index.tcl:127
+#: lib/index.tcl:193
 msgid "files"
 msgstr "Dateien"
 
 #: lib/choose_repository.tcl:957
 msgid "Initial file checkout failed."
-msgstr ""
+msgstr "Erstellen der Arbeitskopie fehlgeschlagen."
 
 #: lib/choose_repository.tcl:973
 msgid "Open"
@@ -1246,7 +1259,7 @@ msgid ""
 "\n"
 "A good commit message has the following format:\n"
 "\n"
-"- First line: Describe in one sentance what you did.\n"
+"- First line: Describe in one sentence what you did.\n"
 "- Second line: Blank\n"
 "- Remaining lines: Describe why this change is good.\n"
 msgstr ""
@@ -1291,7 +1304,7 @@ msgstr "Keine Änderungen, die eingetragen werden können."
 #: lib/commit.tcl:303
 #, tcl-format
 msgid "warning: Tcl does not support encoding '%s'."
-msgstr ""
+msgstr "Warning: Tcl/Tk unterstützt die Zeichencodierung »%s« nicht."
 
 #: lib/commit.tcl:317
 msgid "commit-tree failed:"
@@ -1446,32 +1459,54 @@ msgid "You must correct the above errors before committing."
 msgstr ""
 "Sie müssen die obigen Fehler zuerst beheben, bevor Sie eintragen können."
 
-#: lib/index.tcl:241
+#: lib/index.tcl:6
+msgid "Unable to unlock the index."
+msgstr "Bereitstellung kann nicht wieder freigegeben werden."
+
+#: lib/index.tcl:15
+msgid "Index Error"
+msgstr "Fehler in Bereitstellung"
+
+#: lib/index.tcl:21
+msgid ""
+"Updating the Git index failed.  A rescan will be automatically started to "
+"resynchronize git-gui."
+msgstr "Das Aktualisieren der Git-Bereitstellung ist fehlgeschlagen. Eine allgemeine Git-Aktualisierung wird jetzt gestartet, um git-gui wieder mit git zu synchronisieren."
+
+#: lib/index.tcl:27
+msgid "Continue"
+msgstr "Fortsetzen"
+
+#: lib/index.tcl:31
+msgid "Unlock Index"
+msgstr "Bereitstellung freigeben"
+
+#: lib/index.tcl:282
 #, tcl-format
 msgid "Unstaging %s from commit"
 msgstr "Datei »%s« aus der Bereitstellung herausnehmen"
 
-#: lib/index.tcl:285
+#: lib/index.tcl:326
 #, tcl-format
 msgid "Adding %s"
 msgstr "»%s« hinzufügen..."
 
-#: lib/index.tcl:340
+#: lib/index.tcl:381
 #, tcl-format
 msgid "Revert changes in file %s?"
 msgstr "Änderungen in Datei »%s« revidieren?"
 
-#: lib/index.tcl:342
+#: lib/index.tcl:383
 #, tcl-format
 msgid "Revert changes in these %i files?"
 msgstr "Änderungen in den gewählten %i Dateien revidieren?"
 
-#: lib/index.tcl:348
+#: lib/index.tcl:389
 msgid "Any unstaged changes will be permanently lost by the revert."
 msgstr ""
 "Alle nicht bereitgestellten Änderungen werden beim Revidieren verloren gehen."
 
-#: lib/index.tcl:351
+#: lib/index.tcl:392
 msgid "Do Nothing"
 msgstr "Nichts tun"
 
@@ -1867,12 +1902,3 @@ msgstr "Kompaktes Datenformat benutzen (für langsame Netzverbindungen)"
 #: lib/transport.tcl:168
 msgid "Include tags"
 msgstr "Mit Markierungen übertragen"
-
-#~ msgid "Next >"
-#~ msgstr "Weiter >"
-
-#~ msgid "Fetch"
-#~ msgstr "Anfordern"
-
-#~ msgid "Unstaged Changes (Will Not Be Committed)"
-#~ msgstr "Nicht bereitgestellte Änderungen (werden nicht eingetragen)"
-- 
1.5.3.4.206.g58ba4

^ permalink raw reply related

* Re: git bundle magic, and other questions
From: Alex Riesen @ 2007-11-24 11:17 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <200711240033.54953.jnareb@gmail.com>

Jakub Narebski, Sat, Nov 24, 2007 00:33:54 +0100:
> Do there exists some agreed upon common extension for git-bundle, or is 
> it just *.bundle (like *.patch)? Do bundles use some magic identifier;
> can I add something (and what) to the 'magic' file, so "file <bundle>"
> would return "git bundle data" (or equivalent)?

Look into bundle.c:

    static const char bundle_signature[] = "# v2 git bundle\n";

^ permalink raw reply

* Re: [RFC/PATCH] git-help: add new options -w (for web) and -i (for info)
From: Alex Riesen @ 2007-11-24 11:34 UTC (permalink / raw)
  To: Christian Couder; +Cc: Junio Hamano, git, Theodore Tso
In-Reply-To: <20071124051650.07fd275f.chriscool@tuxfamily.org>

Christian Couder, Sat, Nov 24, 2007 05:16:50 +0100:
> +valid_tool() {
> +	case "$1" in
> +		firefox | iceweasel | konqueror | w3m)
> +			;; # happy

lynx, links and dillo?

^ permalink raw reply

* Re: What's cooking in git.git (topics)
From: Jeff King @ 2007-11-24 11:38 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0711231319220.27959@racer.site>

On Fri, Nov 23, 2007 at 01:23:44PM +0000, Johannes Schindelin wrote:

> Maybe we could change the (non-fast forward) message into (non-fast 
> forward; need to pull?).

Not unreasonable, although I think our line length is getting a bit
long.  Rejected refs would look something like (actually they say
"[rejected]" but the text is column-aligned with the X's):

 ! XXXXXXX...XXXXXXX ref_name -> ref_name (non-fast forward; need to pull?)

There's 58 characters of text not including the two ref_names, leaving
about 11 characters for each ref name. The name of this topic,
jk/send-pack, would overflow an 80-character terminal:

 ! [rejected]        jk/send-pack -> jk/send-pack (non-fast forward; need to pull?)

-Peff

^ permalink raw reply

* Re: [PATCH] Add config_int() method to the Git perl module
From: Jeff King @ 2007-11-24 11:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git, Dan Zwell
In-Reply-To: <7vabp4u40y.fsf@gitster.siamese.dyndns.org>

On Fri, Nov 23, 2007 at 11:59:25AM -0800, Junio C Hamano wrote:

> Maybe in a similar way, we might want to add --color to "git
> config" to return ANSI sequence, so that Git::config_color() can
> work without even loading Term::ANSIColor?

We would also need a way of parsing the 'default' values, so git-config
would need a way of saying "turn this value into its internal
representation" (or the perl script would have to specify its defaults
as raw ANSI codes, which is a bit ugly, but is that the C programs do).

-Peff

^ permalink raw reply

* [PATCH 0/3] Updates to git-add--interactive
From: Wincent Colaiuta @ 2007-11-24 12:55 UTC (permalink / raw)
  To: git; +Cc: gitster, peff
In-Reply-To: <7vk5o8smaf.fsf@gitster.siamese.dyndns.org>

Based on feedback from Junio last night here is a new series. This one
goes on top of the "next" branch.

I moved the pathspec validity checking into builtin-add, thus
simplifying things considerably. I also enforced some strict assumptions
about how the optional arguments will be passed from builtin-add to
git-add--interactive; I can do this because it is the only caller, and
it once again makes things a bit simpler.

I don't expect this to actually be applied as-is, as there are some
doubts I have which I have added to the emails for each patch. In
particular there is a performance issue with the pathspec validity
checking (no idea why it is so much slower than just invoking
git-ls-files), and the behaviour is not exactly where I'd like it to be
(things like "git-add -i ." don't work because "." is considered
invalid).

So looking for feedback on how to address this issues and will resubmit.

^ permalink raw reply

* [PATCH 2/3] Move pathspec validation into interactive_add
From: Wincent Colaiuta @ 2007-11-24 12:55 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Wincent Colaiuta
In-Reply-To: <1195908922-88023-2-git-send-email-win@wincent.com>

Simplify git-add--interactive by moving the pathspec validation into the
interactive_add() function of builtin-add. We can do this because
builtin-add is the only caller of git-add--interactive.

The validate_pathspec() function added by this commit is based on a
sample posted to the mailing list by Junio Hamano.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
---

Note that I made a couple of changes to the code posted by Junio on the
mailing list to make the behaviour a little more convenient. At this
stage it's just a proposal, and there are some issues that I'd like to
see ironed out.

Instead of throwing away the return status of pathspec_match() I am
keeping it, and any successful match breaks out of the loop early. I
observed that passing in a file parameter like "commit.h" in the Git
repo the loop would execute over a thousand times, with pathspec_match
returning 0 some of the time and 1 at others. Evidently any time it
returns 1 that's enough to indicate that it's a valid pathspec.

One issue is that performance is very slow. If you do something like
"git-add -i *.c" then there is a very noticeable delay.

Another issue is that simple shell shortcuts don't work, so something
as simple as "git-add -i ." will report:

  error: pathspec '.' did not match any file(s) known to git.

It would be nice if that could be detected as valid because it does
work when you pass it to git-add--interactive.

Likewise it's not possible to validate pathspecs like "\*.sh" either,
but seeing as these won't work when passed to git-add--interactive
guess it doesn't matter (because they don't work with git-diff-files
either, which is what git-add--interactive is using).

 builtin-add.c             |   38 ++++++++++++++++++++++++++++++++++----
 builtin-commit.c          |    2 +-
 commit.h                  |    2 +-
 git-add--interactive.perl |   12 ++----------
 4 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/builtin-add.c b/builtin-add.c
index dd895df..06212c3 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -135,10 +135,40 @@ static void refresh(int verbose, const char **pathspec)
         free(seen);
 }
 
-int interactive_add(int argc, const char **argv)
+static int validate_pathspec(const char *prefix, const char **pattern)
 {
-	int status;
-	const char **args = xmalloc(sizeof(const char *) * (argc + 1));
+	int i, ret = 0;
+	char *m;
+
+	if (!pattern || !*pattern)
+		return 0;
+
+	for (i = 0; pattern[i]; i++)
+		;
+	m = xcalloc(1, i);
+	for (i = 0; i < active_nr; i++) {
+		struct cache_entry *ce = active_cache[i];
+		if ((ret = pathspec_match(pattern, m, ce->name, 0)))
+			break;
+	}
+	if (!ret)
+		report_path_error(m, pattern, prefix ? strlen(prefix) : 0);
+	free(m);
+	return ret;
+}
+
+int interactive_add(const char *prefix, int argc, const char **argv)
+{
+	int i, status;
+	const char **args;
+	if (read_cache() < 0)
+		die("index file corrupt");
+	for (i = 0; i < argc; i++) {
+		if (!(status = validate_pathspec(prefix, &argv[i])))
+			return 1;
+	}
+
+	args = xmalloc(sizeof(const char *) * (argc + 2));
 	args[0] = "add--interactive";
 	memcpy((void *)args + sizeof(const char *), argv, sizeof(const char *) * argc);
 	args[argc + 1] = NULL;
@@ -176,7 +206,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	argc = parse_options(argc, argv, builtin_add_options,
 			  builtin_add_usage, 0);
 	if (add_interactive)
-		exit(interactive_add(argc, argv));
+		exit(interactive_add(prefix, argc, argv));
 
 	git_config(git_default_config);
 
diff --git a/builtin-commit.c b/builtin-commit.c
index 5d27102..95d1c0d 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -165,7 +165,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 	const char **pathspec = NULL;
 
 	if (interactive) {
-		interactive_add(argc, argv);
+		interactive_add(prefix, argc, argv);
 		commit_style = COMMIT_AS_IS;
 		return get_index_file();
 	}
diff --git a/commit.h b/commit.h
index 9f0765b..dc6fe31 100644
--- a/commit.h
+++ b/commit.h
@@ -113,7 +113,7 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads,
 
 int in_merge_bases(struct commit *, struct commit **, int);
 
-extern int interactive_add(int argc, const char **argv);
+extern int interactive_add(const char *prefix, int argc, const char **argv);
 extern int rerere(void);
 
 static inline int single_parent(struct commit *commit)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 15b2c9f..381bcbe 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -56,17 +56,9 @@ sub list_modified {
 	my ($only) = @_;
 	my (%data, @return);
 	my ($add, $del, $adddel, $file);
-	my @tracked = ();
-
-	if (@ARGV) {
-		@tracked = map {
-			chomp $_; $_;
-		} run_cmd_pipe(qw(git ls-files --exclude-standard --), @ARGV);
-		return if (!@tracked);
-	}
 
 	for (run_cmd_pipe(qw(git diff-index --cached
-			     --numstat --summary HEAD --), @tracked)) {
+			     --numstat --summary HEAD --), @ARGV)) {
 		if (($add, $del, $file) =
 		    /^([-\d]+)	([-\d]+)	(.*)/) {
 			my ($change, $bin);
@@ -89,7 +81,7 @@ sub list_modified {
 		}
 	}
 
-	for (run_cmd_pipe(qw(git diff-files --numstat --summary --), @tracked)) {
+	for (run_cmd_pipe(qw(git diff-files --numstat --summary --), @ARGV)) {
 		if (($add, $del, $file) =
 		    /^([-\d]+)	([-\d]+)	(.*)/) {
 			if (!exists $data{$file}) {
-- 
1.5.3.6.1992.gd646-dirty

^ permalink raw reply related

* [PATCH 3/3] Add "--patch" option to git-add--interactive
From: Wincent Colaiuta @ 2007-11-24 12:55 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Wincent Colaiuta
In-Reply-To: <1195908922-88023-3-git-send-email-win@wincent.com>

When the "--patch" option is supplied, the patch_update_file function is
called, once for each supplied pathspec argument, and then we exit.

Seeing as builtin-add is the only caller of git-add--interactive we can
impose a strict requirement on the format of the arguments to avoid
possible ambiguity: an "--" argument must be used whenever any pathspecs
are passed, both with the "--patch" option and without it.

This commit adds an early return mechanism to the patch_update_pathspec
function to prevent spurious line feeds from being echoed when the user
passes in pathspecs which match unchanged files.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
---

I am sure that someone who actually knows Perl will be able to come up
with a more compact implementation of the process_args() function.
This works, but it's written by a Perl amateur.

 Documentation/git-add.txt |    9 ++++++++-
 builtin-add.c             |   17 ++++++++++-------
 git-add--interactive.perl |   35 ++++++++++++++++++++++++++++++++---
 3 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 63829d9..ce22de8 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -61,7 +61,14 @@ OPTIONS
 
 -i, \--interactive::
 	Add modified contents in the working tree interactively to
-	the index.
+	the index. Optional path arguments may be supplied to limit
+	operation to a subset of the working tree. See ``Interactive
+	mode'' for details.
+
+-p, \--patch:
+	Similar to Interactive mode but the initial command loop is
+	bypassed and the 'patch' subcommand is invoked using each of
+	the specified filepatterns before exiting.
 
 -u::
 	Update only files that git already knows about. This is similar
diff --git a/builtin-add.c b/builtin-add.c
index 06212c3..e69bc13 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -19,7 +19,7 @@ static const char * const builtin_add_usage[] = {
 	"git-add [options] [--] <filepattern>...",
 	NULL
 };
-
+static int patch_interactive = 0, add_interactive = 0;
 static int take_worktree_changes;
 
 static void prune_directory(struct dir_struct *dir, const char **pathspec, int prefix)
@@ -159,7 +159,7 @@ static int validate_pathspec(const char *prefix, const char **pattern)
 
 int interactive_add(const char *prefix, int argc, const char **argv)
 {
-	int i, status;
+	int i, status, pre_argc;
 	const char **args;
 	if (read_cache() < 0)
 		die("index file corrupt");
@@ -168,10 +168,13 @@ int interactive_add(const char *prefix, int argc, const char **argv)
 			return 1;
 	}
 
-	args = xmalloc(sizeof(const char *) * (argc + 2));
+	pre_argc = patch_interactive ? 3 : 2;
+	args = xmalloc(sizeof(const char *) * (argc + pre_argc + 1));
 	args[0] = "add--interactive";
-	memcpy((void *)args + sizeof(const char *), argv, sizeof(const char *) * argc);
-	args[argc + 1] = NULL;
+	args[1]	= patch_interactive ? "--patch" : "--";
+	args[2] = "--";
+	memcpy((void *)args + sizeof(const char *) * pre_argc, argv, sizeof(const char *) * argc);
+	args[argc + pre_argc] = NULL;
 
 	status = run_command_v_opt(args, RUN_GIT_CMD);
 	free(args);
@@ -184,13 +187,13 @@ static const char ignore_error[] =
 "The following paths are ignored by one of your .gitignore files:\n";
 
 static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0;
-static int add_interactive = 0;
 
 static struct option builtin_add_options[] = {
 	OPT__DRY_RUN(&show_only),
 	OPT__VERBOSE(&verbose),
 	OPT_GROUP(""),
 	OPT_BOOLEAN('i', "interactive", &add_interactive, "interactive picking"),
+	OPT_BOOLEAN('p', "patch", &patch_interactive, "interactive patching"),
 	OPT_BOOLEAN('f', NULL, &ignored_too, "allow adding otherwise ignored files"),
 	OPT_BOOLEAN('u', NULL, &take_worktree_changes, "update tracked files"),
 	OPT_BOOLEAN( 0 , "refresh", &refresh_only, "don't add, only refresh the index"),
@@ -205,7 +208,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 
 	argc = parse_options(argc, argv, builtin_add_options,
 			  builtin_add_usage, 0);
-	if (add_interactive)
+	if (add_interactive || patch_interactive)
 		exit(interactive_add(prefix, argc, argv));
 
 	git_config(git_default_config);
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 381bcbe..7d62ceb 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -2,6 +2,9 @@
 
 use strict;
 
+# command line options
+my $patch;
+
 sub run_cmd_pipe {
 	if ($^O eq 'MSWin32') {
 		my @invalid = grep {m/[":*]/} @_;
@@ -335,7 +338,8 @@ sub add_untracked_cmd {
 
 sub parse_diff {
 	my ($path) = @_;
-	my @diff = run_cmd_pipe(qw(git diff-files -p --), $path);
+	my @diff = run_cmd_pipe(qw(git diff-files -p --), $path)
+	    or return undef;
 	my (@hunk) = { TEXT => [] };
 
 	for (@diff) {
@@ -571,6 +575,7 @@ sub patch_update_pathspec {
 	my ($ix, $num);
 	my $path = shift;
 	my ($head, @hunk) = parse_diff($path);
+	return unless $head;
 	for (@{$head->{TEXT}}) {
 		print;
 	}
@@ -775,6 +780,20 @@ add untracked - add contents of untracked files to the staged set of changes
 EOF
 }
 
+sub process_args {
+	return unless @ARGV;
+	my $arg = shift @ARGV;
+	if ($arg eq "--patch") {
+		$patch = 1;
+		$arg = shift @ARGV or die "missing --";
+		die "invalid argument $arg, expecting --"
+		    unless $arg eq "--";
+	}
+	elsif ($arg ne "--") {
+		die "invalid argument $arg, expecting --";
+	}
+}
+
 sub main_loop {
 	my @cmd = ([ 'status', \&status_cmd, ],
 		   [ 'update', \&update_cmd, ],
@@ -803,6 +822,16 @@ sub main_loop {
 	}
 }
 
+process_args();
 refresh();
-status_cmd();
-main_loop();
+if ($patch) {
+	print "No filepattern specified: what did you want to patch?\n"
+	    unless @ARGV;
+	foreach my $pathspec (@ARGV) {
+		patch_update_pathspec($pathspec);
+	}
+}
+else {
+	status_cmd();
+	main_loop();
+}
-- 
1.5.3.6.1992.gd646-dirty

^ permalink raw reply related

* [PATCH 1/3] Rename patch_update_file function to patch_update_pathspec
From: Wincent Colaiuta @ 2007-11-24 12:55 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Wincent Colaiuta
In-Reply-To: <1195908922-88023-1-git-send-email-win@wincent.com>

The patch_update_file function really works on pathspecs, not files, so
rename it to reflect its actual purpose.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
---
 git-add--interactive.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index e347216..15b2c9f 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -571,11 +571,11 @@ sub patch_update_cmd {
 				       HEADER => $status_head, },
 				     @mods);
 	for (@them) {
-		patch_update_file($_->{VALUE});
+		patch_update_pathspec($_->{VALUE});
 	}
 }
 
-sub patch_update_file {
+sub patch_update_pathspec {
 	my ($ix, $num);
 	my $path = shift;
 	my ($head, @hunk) = parse_diff($path);
-- 
1.5.3.6.1992.gd646-dirty

^ permalink raw reply related

* Re: [RFC/PATCH] git-help: add new options -w (for web) and -i (for info)
From: Andreas Ericsson @ 2007-11-24 13:03 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Christian Couder, Junio Hamano, git, Theodore Tso
In-Reply-To: <20071124113421.GB2948@steel.home>

Alex Riesen wrote:
> Christian Couder, Sat, Nov 24, 2007 05:16:50 +0100:
>> +valid_tool() {
>> +	case "$1" in
>> +		firefox | iceweasel | konqueror | w3m)
>> +			;; # happy
> 
> lynx, links and dillo?
> 

Why bother validating it at all? I might be using a script to
add some formatting and then pass it through the browser of my
choice. A friend of mine who's visually impaired does just that
to strip some CSS tags which can make docs quite unreadable for
him.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply

* Re: [WIP PATCH] Add 'git fast-export', the sister of 'git fast-import'
From: Nguyen Thai Ngoc Duy @ 2007-11-24 14:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0711231428350.27959@racer.site>

On Nov 23, 2007 9:31 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Fri, 23 Nov 2007, Nguyen Thai Ngoc Duy wrote:
>
> > On Nov 21, 2007 10:40 AM, Johannes Schindelin
> > <Johannes.Schindelin@gmx.de> wrote:
> > >
> > > [WIP: this does not handle tags yet, and it lacks a test script
> > >  as well as documentation.]
> > >
> > > This program dumps (parts of) a git repository in the format that
> > > fast-import understands.
> > >
> > > For clarity's sake, it does not use the 'inline' method of specifying
> > > blobs in the commits, but builds the blobs before building the commits.B
> > >
> > > ---
> > >         I am way too tired now to continue, but maybe someone else wants
> > >         to pick up the ball.
> >
> > Well, I would better be back on setup_git_directory() than picking up
> > the ball.
>
> Concur.
>
> > I have a suggestion though. git-fast-export and git-fast-import should
> > support bundle.
>
> I think this is not what fast-export and fast-import are about.  They use
> an easy to generate, and easy to edit, format.
>
> Bundles are optimised transport mechanisms for sneaker net.  They are not
> to be meant to be easy to edit, but as small as possible.
>
> > Bundle is very handy for transferring a bunch of commits, but it does
> > not (cannot?) hold tags and branches.
>
> But they can!  Nothing prevents you from calling
>
>         git bundle create a1.bundle refs/tags/v1.0.0 refs/heads/next
>
> (At least this is the idea, haven't tested yet).

It can store commits and heavy tags, but it won't restore tags to
refs/tags or advance branches.

-- 
Duy

^ permalink raw reply


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