* Re: [PATCH] git-gui: fix selection regression introduced in a8ca786991
From: Bert Wesarg @ 2012-01-14 11:58 UTC (permalink / raw)
To: Pat Thoyts; +Cc: git, Bert Wesarg, Shawn O. Pearce
In-Reply-To: <CAKPyHN0xRD7qYyLYaCB9u7mhCZYFObuTdJGHq-rRST-cEhTtXA@mail.gmail.com>
Hi Pat,
On Mon, Jan 9, 2012 at 10:28, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> Hi,
>
> On Sat, Jan 7, 2012 at 20:43, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
>> While fixing the problem from a8ca786991, it introduces a regression
>> regarding what happen after the multi selected file operation (ie.
>> one of Ctrl-{T,U,J}) because the next selected file could not be handled
>> by such a subsequent file operation.
>>
>> The right way is to move the fix from this commit down into the show_diff
>> function. So that all code path add the current diff path to the list of
>> selections.
>>
>> This also simplifies helper functions for these operatione which needed
>> to handle the case whether there is only the current diff path or also
>> a selction.
>
> I think we need to think this more through, especially with input from
> Shawn, please.
>
> I have now find out, that git-gui has two selections in the file
> lists. The first is that for the current path for what we show the
> diff (the tag for this is called 'in_diff') and the the second is that
> for the current list of paths which are selected ('in_sel'). The file
> list operations 'staging', 'reverting', 'unstaging', work either on
> 'in_sel'; if that is not empty, or on 'in_diff'. The problem I've now
> realized is, that these two selections share the same visual hints,
> ie. a lightgray background.
>
> The problem I tried to solve in a8ca786991 was, that adding paths to
> the selection with Ctrl-Button-1 or Shift-cutton-1, didn't included
> the current diff path in the subsequent file list operation. But I
> would have expected it, because it was visual in the 'selection'.
>
> My current 'workaround' is to make the two selections visually
> distinguishable (and reverting a8ca786991), by using a different
> background color for the 'in_sel' tag and also the italic font, so
> that it is still possible to see whether the current diff path is in
> the selection or not:
>
> @@ -717,11 +717,11 @@ proc tk_optionMenu {w varName args} {
> proc rmsel_tag {text} {
> $text tag conf sel \
> -background [$text cget -background] \
> -foreground [$text cget -foreground] \
> -borderwidth 0
> - $text tag conf in_sel -background lightgray
> + $text tag conf in_sel -background SlateGray1 -font font_diffitalic
> bind $text <Motion> break
> return $text
> }
>
> wm withdraw .
> @@ -3557,11 +3557,11 @@ if {$use_ttk} {
> .vpane.files add .vpane.files.index -sticky news
> }
>
> foreach i [list $ui_index $ui_workdir] {
> rmsel_tag $i
> - $i tag conf in_diff -background [$i tag cget in_sel -background]
> + $i tag conf in_diff -background lightgray
> }
> unset i
>
> set files_ctxm .vpane.files.ctxm
> menu $files_ctxm -tearoff 0
>
> I'm not very pleased with this, but at least it is now possible to
> visual recognize what files will be handled by a subsequent file list
> operation.
>
> Any input is more than welcome.
>
I think we don't resolve this now, because a8ca786991 introduced a
regression introduced in 0.16, I propose to revert it for upcoming
1.7.9 release.
Thanks.
Bert
> Regards,
> Bert
^ permalink raw reply
* Re: Commit changes to remote repository
From: Carlos Martín Nieto @ 2012-01-14 11:31 UTC (permalink / raw)
To: ruperty; +Cc: git
In-Reply-To: <1326486589088-7185551.post@n2.nabble.com>
[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]
On Fri, Jan 13, 2012 at 12:29:49PM -0800, ruperty wrote:
> Being new to git I am probably not doing things correctly so pointers in the
> right direction would be useful.
>
> What I want to do make changes on my laptop and commit them to a remote
> repository. Here is what I have done,
>
> 1. Created a repository on my remote linux host, in a folder of cource code,
> by,
>
> git init
> git add *
> git commit
>
> 2. On my laptop I did a git clone pointing by ssh to the remote repo which
> downloaded all the files to my local system.
>
> 3. I changed a file locally and did a commit.
>
> 4. I then wanted to update the remote repo with my change, which I did with
> a git push, but that didn't work, getting this error,
>
> remote: error: refusing to update checked out branch:
> refs/heads/master^[[K
> remote: error: By default, updating the current branch in a non-bare
> repository^[[K.......
>
>
> What am I doing wrong?
You're trying to push to a non-bare repository and change the
currently active branch, which can cause problems, so git isn't
letting you. There's an explanation of bare and non-bare at
http://bare-vs-nonbare.gitrecipes.de/ but the short and sweet is that
you should init the repo you want to use as the central point with
--bare and do modifications locally and then push there.
cmn
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH 2/2] git-gui: fix applying line/ranges when the selection ends at the begin of a line
From: Bert Wesarg @ 2012-01-14 11:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Pat Thoyts, git
In-Reply-To: <7vaa5qydj7.fsf@alter.siamese.dyndns.org>
On Sat, Jan 14, 2012 at 08:00, Junio C Hamano <gitster@pobox.com> wrote:
> Bert Wesarg <bert.wesarg@googlemail.com> writes:
>
>> On Mon, Jan 9, 2012 at 14:43, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
>>> Selecting also the trailing newline of a line for staging/unstaging would
>>> have resulted in also staging/unstaging of the next line.
>>
>> same here, could you please consider pushing this into the 1.7.9
>> release. I see no point in waiting for the next release.
>
> I do not use git-gui myself, so I wasn't paying much attention to these
> two patches.
>
> If these two fixes are for a new feature that was not present in v1.7.8
> but has already been merged before v1.7.8-rc1, then do please make sure to
> push them forward.
>
> On the other hand, if they are fixes for an old feature that was already
> in v1.7.8, then it is a bit too late for the next release.
>
Thanks, considering this, than these two patches have to wait for the
next release.
Bert
> Thanks.
^ permalink raw reply
* Re: git grep doesn't follow symbolic link
From: Nguyen Thai Ngoc Duy @ 2012-01-14 9:50 UTC (permalink / raw)
To: Junio C Hamano, Pang Yan Han
Cc: Thomas Rast, Ramkumar Ramachandra, Bertrand BENOIT, git
In-Reply-To: <7vwr8za04q.fsf@alter.siamese.dyndns.org>
(Pang's patch [1] caught my attention so I returned to the original discussion)
[1] http://thread.gmane.org/gmane.comp.version-control.git/188552
On Wed, Jan 11, 2012 at 1:22 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Thomas Rast <trast@student.ethz.ch> writes:
>
>>> I'd imagine so: symbolic links are not portable across different file
>>> systems; Git's internal representation of a symbolic link is a file
>>> containing the path of the file to be linked to.
>>
>> I'd actually welcome a fix to this general area,...
>
> Even though some platforms may lack symbolic links, where they are
> supported, they have a clear and defined meaning and that is what Git
> tracks as contents: where the link points at.
>
> So we would want our "git diff" to tell us, even if you moved without
> content modification the symbolic link target that lives somewhere on your
> filesystem but is outside the control of Git, and updated a symbolic link
> that is tracked by Git to point to a new location, that you updated the
> link. On the other hand, if you did not update a tracked symbolic link,
> even if the location the link points at that may or may not be under the
> control of Git, we do not want "git diff" to show anything. As far as that
> link is concerned, nothing has changed.
>
> Changing this would not be a fix; it would be butchering.
That's a good default. But git should allow me to say "diff the files
that symlinks point to". Link target is content from git perspective,
not from user perspective.
So instead changing the default behavior specifically for git-grep as
Pang did, I think adding --follow-symlinks option, that could be
passed to grep or any of diff family, would be a better approach.
--
Duy
^ permalink raw reply
* [PATCH v2 2/2] tree_entry_interesting: make recursive mode default
From: Nguyễn Thái Ngọc Duy @ 2012-01-14 9:23 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Nieder, Linus Torvalds,
Nguyễn Thái Ngọc Duy
In-Reply-To: <1326533003-19686-1-git-send-email-pclouds@gmail.com>
There is a bit of history behind this. Some time ago, t_e_i() only
supported prefix matching. diff-tree supported recursive and
non-recursive mode but it did not make any difference to prefix
matching.
Later on, t_e_i() gained limited recursion support to unify a similar
matching code used by git-grep. It introduced two new fields in struct
pathspec: max_depth and recursive. "recursive" field functions as a
feature switch so that this feature is off by default.
Some time after that, t_e_i() further gained wildcard support. With
wildcard matching, recursive and non-recursive diff-tree
mattered. "recursive" field was reused to distinguish recursion in
diff-tree.
This choice has a side effect that by default wildcard matching is in
non-recursive mode, which is not true. All current call sites except
"diff-tree without -r" (grep, traverse_commit_list, tree-walk and
general tree diff) prefer recursive mode.
This patch decouples the use of recursive field. The max_depth feature
switch is now controlled by max_depth_valid field. diff-tree recursion
is controlled by onelevel_only, which makes it recursive by default.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
The ugly name "nonrecursive_diff_tree" is changed to "onelevel_only".
builtin/grep.c | 2 +-
cache.h | 3 ++-
dir.c | 4 ++--
t/t4010-diff-pathspec.sh | 8 ++++++++
tree-diff.c | 3 +--
tree-walk.c | 8 ++++----
6 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 9ce064a..c081bf4 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1051,7 +1051,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
paths = get_pathspec(prefix, argv + i);
init_pathspec(&pathspec, paths);
pathspec.max_depth = opt.max_depth;
- pathspec.recursive = 1;
+ pathspec.max_depth_valid = 1;
if (show_in_pager && (cached || list.nr))
die(_("--open-files-in-pager only works on the worktree"));
diff --git a/cache.h b/cache.h
index 10afd71..0c4067d 100644
--- a/cache.h
+++ b/cache.h
@@ -526,7 +526,8 @@ struct pathspec {
const char **raw; /* get_pathspec() result, not freed by free_pathspec() */
int nr;
unsigned int has_wildcard:1;
- unsigned int recursive:1;
+ unsigned int max_depth_valid:1;
+ unsigned int onelevel_only:1;
int max_depth;
struct pathspec_item {
const char *match;
diff --git a/dir.c b/dir.c
index 0a78d00..5af3567 100644
--- a/dir.c
+++ b/dir.c
@@ -258,7 +258,7 @@ int match_pathspec_depth(const struct pathspec *ps,
int i, retval = 0;
if (!ps->nr) {
- if (!ps->recursive || ps->max_depth == -1)
+ if (!ps->max_depth_valid || ps->max_depth == -1)
return MATCHED_RECURSIVELY;
if (within_depth(name, namelen, 0, ps->max_depth))
@@ -275,7 +275,7 @@ int match_pathspec_depth(const struct pathspec *ps,
if (seen && seen[i] == MATCHED_EXACTLY)
continue;
how = match_pathspec_item(ps->items+i, prefix, name, namelen);
- if (ps->recursive && ps->max_depth != -1 &&
+ if (ps->max_depth_valid && ps->max_depth != -1 &&
how && how != MATCHED_FNMATCH) {
int len = ps->items[i].len;
if (name[len] == '/')
diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh
index fbc8cd8..af5134b 100755
--- a/t/t4010-diff-pathspec.sh
+++ b/t/t4010-diff-pathspec.sh
@@ -48,6 +48,14 @@ test_expect_success \
compare_diff_raw current expected'
cat >expected <<\EOF
+:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
+EOF
+test_expect_success \
+ '"*file1" should show path1/file1' \
+ 'git diff-index --cached $tree -- "*file1" >current &&
+ compare_diff_raw current expected'
+
+cat >expected <<\EOF
:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M file0
EOF
test_expect_success \
diff --git a/tree-diff.c b/tree-diff.c
index 28ad6db..fbc683c 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -137,8 +137,7 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2,
enum interesting t2_match = entry_not_interesting;
/* Enable recursion indefinitely */
- opt->pathspec.recursive = DIFF_OPT_TST(opt, RECURSIVE);
- opt->pathspec.max_depth = -1;
+ opt->pathspec.onelevel_only = !DIFF_OPT_TST(opt, RECURSIVE);
strbuf_init(&base, PATH_MAX);
strbuf_add(&base, base_str, baselen);
diff --git a/tree-walk.c b/tree-walk.c
index 492c7cd..fdecacc 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -588,7 +588,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
entry_not_interesting : all_entries_not_interesting;
if (!ps->nr) {
- if (!ps->recursive || ps->max_depth == -1)
+ if (!ps->max_depth_valid || ps->max_depth == -1)
return all_entries_interesting;
return within_depth(base->buf + base_offset, baselen,
!!S_ISDIR(entry->mode),
@@ -609,7 +609,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
if (!match_dir_prefix(base_str, match, matchlen))
goto match_wildcards;
- if (!ps->recursive || ps->max_depth == -1)
+ if (!ps->max_depth_valid || ps->max_depth == -1)
return all_entries_interesting;
return within_depth(base_str + matchlen + 1,
@@ -634,7 +634,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
* Match all directories. We'll try to
* match files later on.
*/
- if (ps->recursive && S_ISDIR(entry->mode))
+ if (!ps->onelevel_only && S_ISDIR(entry->mode))
return entry_interesting;
}
@@ -665,7 +665,7 @@ match_wildcards:
* in future, see
* http://thread.gmane.org/gmane.comp.version-control.git/163757/focus=163840
*/
- if (ps->recursive && S_ISDIR(entry->mode))
+ if (!ps->onelevel_only && S_ISDIR(entry->mode))
return entry_interesting;
}
return never_interesting; /* No matches */
--
1.7.8.36.g69ee2
^ permalink raw reply related
* [PATCH v2 1/2] Document limited recursion pathspec matching with wildcards
From: Nguyễn Thái Ngọc Duy @ 2012-01-14 9:23 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Nieder, Linus Torvalds,
Nguyễn Thái Ngọc Duy
In-Reply-To: <1326341371-16628-1-git-send-email-pclouds@gmail.com>
It's actually unlimited recursion if wildcards are active regardless
--max-depth
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Regarding Junio's question earlier:
> - Shouldn't "onelevel_only" be the same as limiting to a single depth
> with "max_depth"?
Doing that would change the behavior of "git grep --max-depth=0 -- 'a*'"
from unlimited recursion currently to limited. We did not come to agree
how --max-depth should behave with wildcards last time it was discussed,
so it's best separating two flags (in the next patch) for now.
Documentation/git-grep.txt | 3 +++
tree-walk.c | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 15d6711..6a8b1e3 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -79,6 +79,9 @@ OPTIONS
--max-depth <depth>::
For each <pathspec> given on command line, descend at most <depth>
levels of directories. A negative value means no limit.
+ This option is ignored if <pathspec> contains active wildcards.
+ In other words if "a*" matches a directory named "a*",
+ "*" is matched literally so --max-depth is still effective.
-w::
--word-regexp::
diff --git a/tree-walk.c b/tree-walk.c
index f82dba6..492c7cd 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -661,6 +661,9 @@ match_wildcards:
/*
* Match all directories. We'll try to match files
* later on.
+ * max_depth is ignored but we may consider support it
+ * in future, see
+ * http://thread.gmane.org/gmane.comp.version-control.git/163757/focus=163840
*/
if (ps->recursive && S_ISDIR(entry->mode))
return entry_interesting;
--
1.7.8.36.g69ee2
^ permalink raw reply related
* Re: difftool / mergetool waiting
From: Andreas Schwab @ 2012-01-14 8:38 UTC (permalink / raw)
To: Jonathan Seng; +Cc: git
In-Reply-To: <CAG=s6FnG=3hO5jykc8s40SrCPfvJSvtEMVNBSihX5Y7T3b9SMg@mail.gmail.com>
Jonathan Seng <nekenyu@gmail.com> writes:
> If wait is false, git would fire off the tool command and proceed to
> the next then exit cleanly.
That doesn't work for git mergetool, it wouldn't be able to postprocess
the result of calling the tool command.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply
* Re: [PATCH v4 00/10] nd/clone-detached
From: Nguyen Thai Ngoc Duy @ 2012-01-14 7:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vhazyyduw.fsf@alter.siamese.dyndns.org>
On Fri, Jan 13, 2012 at 10:53:11PM -0800, Junio C Hamano wrote:
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>
> > 2012/1/14 Junio C Hamano <gitster@pobox.com>:
> >> Thanks, replaced (and updated comment strings read much better).
> >>
> >> There were some conlicts I had to resolve while merging this to 'pu'.
> >> I would appreciate it if you can eyeball it to make sure I didn't make
> >> silly mistakes there.
> >
> > Right, the conflict with nd/clone-single-branch. I kept thinking there
> > would not be conflict because clone-single-branch's big change was in
> > wanted_peer_refs() and missed write_followtags() call. The merge looks
> > good.
>
> Hmm, 'pu' seems to fail its selftest with this merge present, though.
The commit "refuse to clone if --branch points to bogus ref" from this
series changes clone's behavior that t5500.31, which is added in
nd/clone-single-branch, relies on. This makes "make test" pass for me
on pu:
-- 8< --
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 7e85c71..c4e675f 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -283,10 +283,7 @@ test_expect_success 'clone shallow object count' '
'
test_expect_success 'clone shallow with nonexistent --branch' '
- git clone --depth 1 --branch Z "file://$(pwd)/." shallow4 &&
- GIT_DIR=shallow4/.git git rev-parse HEAD >actual &&
- git rev-parse HEAD >expected &&
- test_cmp expected actual
+ test_must_fail git clone --depth 1 --branch Z "file://$(pwd)/." shallow4
'
test_expect_success 'clone shallow with detached HEAD' '
-- 8< --
I'd rather remove the test, but removing something in a merge does not
sound wise.
Another cleaner approach is to combine the two clone series into
one. If you want to go this way, pick one as base, I'll rebase the
other on top and resend.
--
Duy
^ permalink raw reply related
* Re: [PATCH] grep: resolve symlinks for --no-index and untracked symlinks for --untracked
From: Pang Yan Han @ 2012-01-14 7:14 UTC (permalink / raw)
To: git
Cc: Bertrand BENOIT, Ramkumar Ramachandra, Thomas Rast,
Junio C Hamano, Pang Yan Han
Sorry, this should be a PATCH/RFC
On Sat, Jan 14, 2012 at 03:10:50PM +0800, Pang Yan Han wrote:
> For a tracked symbolic link, git tracks where the symbolic link points to
> and as such, git grep does not search for patterns in where the symbolic link
> points to.
>
> However, git grep with --no-index is supposed to work similarly to GNU grep by
> pretending that the current directory is not a git repository and hence resolve
> symbolic links.
>
> When used with the --untracked option, untracked symbolic links should also
> be resolved.
>
> Teach git grep to resolve symbolic links for --no-index and untracked symbolic
> links for --untracked.
> ---
> builtin/grep.c | 49 +++++++++++++++++++++++++++++++++++--------------
> t/t7810-grep.sh | 35 +++++++++++++++++++++++++++++++++++
> 2 files changed, 70 insertions(+), 14 deletions(-)
>
> diff --git a/builtin/grep.c b/builtin/grep.c
> index 9ce064a..c7883c3 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -29,9 +29,12 @@ static int use_threads = 1;
> #define THREADS 8
> static pthread_t threads[THREADS];
>
> +#define UNTRACKED 0
> +#define TRACKED 1
> +
> static void *load_sha1(const unsigned char *sha1, unsigned long *size,
> const char *name);
> -static void *load_file(const char *filename, size_t *sz);
> +static void *load_file(const char *filename, size_t *sz, int tracked);
>
> enum work_type {WORK_SHA1, WORK_FILE};
>
> @@ -50,6 +53,11 @@ struct work_item {
> void *identifier;
> char done;
> struct strbuf out;
> + /* indicates whether file is tracked by git.
> + * with --no-index, resolve all symlinks.
> + * with --untracked, resolve only untracked symlinks.
> + */
> + int tracked;
> };
>
> /* In the range [todo_done, todo_start) in 'todo' we have work_items
> @@ -113,7 +121,7 @@ static pthread_cond_t cond_result;
>
> static int skip_first_line;
>
> -static void add_work(enum work_type type, char *name, void *id)
> +static void add_work(enum work_type type, char *name, void *id, int tracked)
> {
> grep_lock();
>
> @@ -125,6 +133,7 @@ static void add_work(enum work_type type, char *name, void *id)
> todo[todo_end].name = name;
> todo[todo_end].identifier = id;
> todo[todo_end].done = 0;
> + todo[todo_end].tracked = tracked;
> strbuf_reset(&todo[todo_end].out);
> todo_end = (todo_end + 1) % ARRAY_SIZE(todo);
>
> @@ -157,13 +166,13 @@ static void grep_sha1_async(struct grep_opt *opt, char *name,
> unsigned char *s;
> s = xmalloc(20);
> memcpy(s, sha1, 20);
> - add_work(WORK_SHA1, name, s);
> + add_work(WORK_SHA1, name, s, TRACKED);
> }
>
> static void grep_file_async(struct grep_opt *opt, char *name,
> - const char *filename)
> + const char *filename, int tracked)
> {
> - add_work(WORK_FILE, name, xstrdup(filename));
> + add_work(WORK_FILE, name, xstrdup(filename), tracked);
> }
>
> static void work_done(struct work_item *w)
> @@ -226,7 +235,7 @@ static void *run(void *arg)
> }
> } else if (w->type == WORK_FILE) {
> size_t sz;
> - void* data = load_file(w->identifier, &sz);
> + void* data = load_file(w->identifier, &sz, w->tracked);
> if (data) {
> hit |= grep_buffer(opt, w->name, data, sz);
> free(data);
> @@ -429,7 +438,7 @@ static int grep_sha1(struct grep_opt *opt, const unsigned char *sha1,
> }
> }
>
> -static void *load_file(const char *filename, size_t *sz)
> +static void *load_file(const char *filename, size_t *sz, int tracked)
> {
> struct stat st;
> char *data;
> @@ -441,6 +450,12 @@ static void *load_file(const char *filename, size_t *sz)
> error(_("'%s': %s"), filename, strerror(errno));
> return NULL;
> }
> + /* Resolve symlink if file is not tracked */
> + if (S_ISLNK(st.st_mode) && !tracked) {
> + memset(&st, 0, sizeof(st));
> + if (stat(filename, &st) < 0)
> + goto err_ret;
> + }
> if (!S_ISREG(st.st_mode))
> return NULL;
> *sz = xsize_t(st.st_size);
> @@ -459,7 +474,8 @@ static void *load_file(const char *filename, size_t *sz)
> return data;
> }
>
> -static int grep_file(struct grep_opt *opt, const char *filename)
> +static int grep_file(struct grep_opt *opt, const char *filename,
> + int tracked)
> {
> struct strbuf buf = STRBUF_INIT;
> char *name;
> @@ -472,14 +488,14 @@ static int grep_file(struct grep_opt *opt, const char *filename)
>
> #ifndef NO_PTHREADS
> if (use_threads) {
> - grep_file_async(opt, name, filename);
> + grep_file_async(opt, name, filename, tracked);
> return 0;
> } else
> #endif
> {
> int hit;
> size_t sz;
> - void *data = load_file(filename, &sz);
> + void *data = load_file(filename, &sz, tracked);
> if (!data)
> hit = 0;
> else
> @@ -541,7 +557,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
> hit |= grep_sha1(opt, ce->sha1, ce->name, 0);
> }
> else
> - hit |= grep_file(opt, ce->name);
> + hit |= grep_file(opt, ce->name, TRACKED);
> if (ce_stage(ce)) {
> do {
> nr++;
> @@ -658,7 +674,7 @@ static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
> }
>
> static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
> - int exc_std)
> + int exc_std, int use_index)
> {
> struct dir_struct dir;
> int i, hit = 0;
> @@ -668,12 +684,17 @@ static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
> setup_standard_excludes(&dir);
>
> fill_directory(&dir, pathspec->raw);
> + if (use_index)
> + read_cache();
> for (i = 0; i < dir.nr; i++) {
> const char *name = dir.entries[i]->name;
> int namelen = strlen(name);
> if (!match_pathspec_depth(pathspec, name, namelen, 0, NULL))
> continue;
> - hit |= grep_file(opt, dir.entries[i]->name);
> + if (use_index && cache_name_exists(name, namelen, ignore_case))
> + hit |= grep_file(opt, dir.entries[i]->name, TRACKED);
> + else
> + hit |= grep_file(opt, dir.entries[i]->name, UNTRACKED);
> if (hit && opt->status_only)
> break;
> }
> @@ -1083,7 +1104,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
> int use_exclude = (opt_exclude < 0) ? use_index : !!opt_exclude;
> if (list.nr)
> die(_("--no-index or --untracked cannot be used with revs."));
> - hit = grep_directory(&opt, &pathspec, use_exclude);
> + hit = grep_directory(&opt, &pathspec, use_exclude, use_index);
> } else if (0 <= opt_exclude) {
> die(_("--[no-]exclude-standard cannot be used for tracked contents."));
> } else if (!list.nr) {
> diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
> index 7ba5b16..fe41095 100755
> --- a/t/t7810-grep.sh
> +++ b/t/t7810-grep.sh
> @@ -647,6 +647,41 @@ test_expect_success 'inside git repository but with --no-index' '
> )
> '
>
> +test_expect_success '--no-index greps contents of targets of symlinks' '
> + mkdir -p repo/sub &&
> + echo hello >repo/file &&
> + echo hello there >repo/sub/file1 &&
> + (cd repo/sub && ln -s ../file link1 && ln -s ../file link2 &&
> + git init && git add link1 && git commit -m "first" &&
> + test_must_fail git grep "hello" &&
> + cat >../expected <<-EOF &&
> + file1:hello there
> + link1:hello
> + link2:hello
> + EOF
> + git grep --no-index "hello" >../actual &&
> + test_cmp ../expected ../actual
> + ) &&
> + rm -rf repo
> +'
> +
> +test_expect_success '--untracked greps targets of untracked symlinks' '
> + mkdir -p repo/sub &&
> + echo hello >repo/file &&
> + echo hello there > repo/sub/file1 &&
> + (cd repo/sub && ln -s ../file link1 && ln -s ../file link2 &&
> + git init && git add link1 && git commit -m "first" &&
> + test_must_fail git grep "hello" &&
> + cat >../expected <<-EOF &&
> + file1:hello there
> + link2:hello
> + EOF
> + git grep --untracked "hello" >../actual &&
> + test_cmp ../expected ../actual
> + ) &&
> + rm -rf repo
> +'
> +
> test_expect_success 'setup double-dash tests' '
> cat >double-dash <<EOF &&
> --
> --
> 1.7.9.rc0.24.ga4351
^ permalink raw reply
* [PATCH] grep: resolve symlinks for --no-index and untracked symlinks for --untracked
From: Pang Yan Han @ 2012-01-14 7:10 UTC (permalink / raw)
To: git
Cc: Bertrand BENOIT, Ramkumar Ramachandra, Thomas Rast,
Junio C Hamano, Pang Yan Han
For a tracked symbolic link, git tracks where the symbolic link points to
and as such, git grep does not search for patterns in where the symbolic link
points to.
However, git grep with --no-index is supposed to work similarly to GNU grep by
pretending that the current directory is not a git repository and hence resolve
symbolic links.
When used with the --untracked option, untracked symbolic links should also
be resolved.
Teach git grep to resolve symbolic links for --no-index and untracked symbolic
links for --untracked.
---
builtin/grep.c | 49 +++++++++++++++++++++++++++++++++++--------------
t/t7810-grep.sh | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 14 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 9ce064a..c7883c3 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -29,9 +29,12 @@ static int use_threads = 1;
#define THREADS 8
static pthread_t threads[THREADS];
+#define UNTRACKED 0
+#define TRACKED 1
+
static void *load_sha1(const unsigned char *sha1, unsigned long *size,
const char *name);
-static void *load_file(const char *filename, size_t *sz);
+static void *load_file(const char *filename, size_t *sz, int tracked);
enum work_type {WORK_SHA1, WORK_FILE};
@@ -50,6 +53,11 @@ struct work_item {
void *identifier;
char done;
struct strbuf out;
+ /* indicates whether file is tracked by git.
+ * with --no-index, resolve all symlinks.
+ * with --untracked, resolve only untracked symlinks.
+ */
+ int tracked;
};
/* In the range [todo_done, todo_start) in 'todo' we have work_items
@@ -113,7 +121,7 @@ static pthread_cond_t cond_result;
static int skip_first_line;
-static void add_work(enum work_type type, char *name, void *id)
+static void add_work(enum work_type type, char *name, void *id, int tracked)
{
grep_lock();
@@ -125,6 +133,7 @@ static void add_work(enum work_type type, char *name, void *id)
todo[todo_end].name = name;
todo[todo_end].identifier = id;
todo[todo_end].done = 0;
+ todo[todo_end].tracked = tracked;
strbuf_reset(&todo[todo_end].out);
todo_end = (todo_end + 1) % ARRAY_SIZE(todo);
@@ -157,13 +166,13 @@ static void grep_sha1_async(struct grep_opt *opt, char *name,
unsigned char *s;
s = xmalloc(20);
memcpy(s, sha1, 20);
- add_work(WORK_SHA1, name, s);
+ add_work(WORK_SHA1, name, s, TRACKED);
}
static void grep_file_async(struct grep_opt *opt, char *name,
- const char *filename)
+ const char *filename, int tracked)
{
- add_work(WORK_FILE, name, xstrdup(filename));
+ add_work(WORK_FILE, name, xstrdup(filename), tracked);
}
static void work_done(struct work_item *w)
@@ -226,7 +235,7 @@ static void *run(void *arg)
}
} else if (w->type == WORK_FILE) {
size_t sz;
- void* data = load_file(w->identifier, &sz);
+ void* data = load_file(w->identifier, &sz, w->tracked);
if (data) {
hit |= grep_buffer(opt, w->name, data, sz);
free(data);
@@ -429,7 +438,7 @@ static int grep_sha1(struct grep_opt *opt, const unsigned char *sha1,
}
}
-static void *load_file(const char *filename, size_t *sz)
+static void *load_file(const char *filename, size_t *sz, int tracked)
{
struct stat st;
char *data;
@@ -441,6 +450,12 @@ static void *load_file(const char *filename, size_t *sz)
error(_("'%s': %s"), filename, strerror(errno));
return NULL;
}
+ /* Resolve symlink if file is not tracked */
+ if (S_ISLNK(st.st_mode) && !tracked) {
+ memset(&st, 0, sizeof(st));
+ if (stat(filename, &st) < 0)
+ goto err_ret;
+ }
if (!S_ISREG(st.st_mode))
return NULL;
*sz = xsize_t(st.st_size);
@@ -459,7 +474,8 @@ static void *load_file(const char *filename, size_t *sz)
return data;
}
-static int grep_file(struct grep_opt *opt, const char *filename)
+static int grep_file(struct grep_opt *opt, const char *filename,
+ int tracked)
{
struct strbuf buf = STRBUF_INIT;
char *name;
@@ -472,14 +488,14 @@ static int grep_file(struct grep_opt *opt, const char *filename)
#ifndef NO_PTHREADS
if (use_threads) {
- grep_file_async(opt, name, filename);
+ grep_file_async(opt, name, filename, tracked);
return 0;
} else
#endif
{
int hit;
size_t sz;
- void *data = load_file(filename, &sz);
+ void *data = load_file(filename, &sz, tracked);
if (!data)
hit = 0;
else
@@ -541,7 +557,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
hit |= grep_sha1(opt, ce->sha1, ce->name, 0);
}
else
- hit |= grep_file(opt, ce->name);
+ hit |= grep_file(opt, ce->name, TRACKED);
if (ce_stage(ce)) {
do {
nr++;
@@ -658,7 +674,7 @@ static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
}
static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
- int exc_std)
+ int exc_std, int use_index)
{
struct dir_struct dir;
int i, hit = 0;
@@ -668,12 +684,17 @@ static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
setup_standard_excludes(&dir);
fill_directory(&dir, pathspec->raw);
+ if (use_index)
+ read_cache();
for (i = 0; i < dir.nr; i++) {
const char *name = dir.entries[i]->name;
int namelen = strlen(name);
if (!match_pathspec_depth(pathspec, name, namelen, 0, NULL))
continue;
- hit |= grep_file(opt, dir.entries[i]->name);
+ if (use_index && cache_name_exists(name, namelen, ignore_case))
+ hit |= grep_file(opt, dir.entries[i]->name, TRACKED);
+ else
+ hit |= grep_file(opt, dir.entries[i]->name, UNTRACKED);
if (hit && opt->status_only)
break;
}
@@ -1083,7 +1104,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
int use_exclude = (opt_exclude < 0) ? use_index : !!opt_exclude;
if (list.nr)
die(_("--no-index or --untracked cannot be used with revs."));
- hit = grep_directory(&opt, &pathspec, use_exclude);
+ hit = grep_directory(&opt, &pathspec, use_exclude, use_index);
} else if (0 <= opt_exclude) {
die(_("--[no-]exclude-standard cannot be used for tracked contents."));
} else if (!list.nr) {
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 7ba5b16..fe41095 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -647,6 +647,41 @@ test_expect_success 'inside git repository but with --no-index' '
)
'
+test_expect_success '--no-index greps contents of targets of symlinks' '
+ mkdir -p repo/sub &&
+ echo hello >repo/file &&
+ echo hello there >repo/sub/file1 &&
+ (cd repo/sub && ln -s ../file link1 && ln -s ../file link2 &&
+ git init && git add link1 && git commit -m "first" &&
+ test_must_fail git grep "hello" &&
+ cat >../expected <<-EOF &&
+ file1:hello there
+ link1:hello
+ link2:hello
+ EOF
+ git grep --no-index "hello" >../actual &&
+ test_cmp ../expected ../actual
+ ) &&
+ rm -rf repo
+'
+
+test_expect_success '--untracked greps targets of untracked symlinks' '
+ mkdir -p repo/sub &&
+ echo hello >repo/file &&
+ echo hello there > repo/sub/file1 &&
+ (cd repo/sub && ln -s ../file link1 && ln -s ../file link2 &&
+ git init && git add link1 && git commit -m "first" &&
+ test_must_fail git grep "hello" &&
+ cat >../expected <<-EOF &&
+ file1:hello there
+ link2:hello
+ EOF
+ git grep --untracked "hello" >../actual &&
+ test_cmp ../expected ../actual
+ ) &&
+ rm -rf repo
+'
+
test_expect_success 'setup double-dash tests' '
cat >double-dash <<EOF &&
--
--
1.7.9.rc0.24.ga4351
^ permalink raw reply related
* Re: [PATCH 2/2] git-gui: fix applying line/ranges when the selection ends at the begin of a line
From: Junio C Hamano @ 2012-01-14 7:00 UTC (permalink / raw)
To: Bert Wesarg; +Cc: Pat Thoyts, git
In-Reply-To: <CAKPyHN0tqQKuPONj_F9MXbgoHxeoZ7pFVSLPNWHddnA8340MGA@mail.gmail.com>
Bert Wesarg <bert.wesarg@googlemail.com> writes:
> On Mon, Jan 9, 2012 at 14:43, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
>> Selecting also the trailing newline of a line for staging/unstaging would
>> have resulted in also staging/unstaging of the next line.
>
> same here, could you please consider pushing this into the 1.7.9
> release. I see no point in waiting for the next release.
I do not use git-gui myself, so I wasn't paying much attention to these
two patches.
If these two fixes are for a new feature that was not present in v1.7.8
but has already been merged before v1.7.8-rc1, then do please make sure to
push them forward.
On the other hand, if they are fixes for an old feature that was already
in v1.7.8, then it is a bit too late for the next release.
Thanks.
^ permalink raw reply
* Re: [PATCH v4 00/10] nd/clone-detached
From: Junio C Hamano @ 2012-01-14 6:53 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <CACsJy8DggQdM1aoeL+u=3Wz+5f7hi4eG=6MHXPCJZ6pOmhQJ_w@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
> 2012/1/14 Junio C Hamano <gitster@pobox.com>:
>> Thanks, replaced (and updated comment strings read much better).
>>
>> There were some conlicts I had to resolve while merging this to 'pu'.
>> I would appreciate it if you can eyeball it to make sure I didn't make
>> silly mistakes there.
>
> Right, the conflict with nd/clone-single-branch. I kept thinking there
> would not be conflict because clone-single-branch's big change was in
> wanted_peer_refs() and missed write_followtags() call. The merge looks
> good.
Hmm, 'pu' seems to fail its selftest with this merge present, though.
^ permalink raw reply
* Re: [PATCH 2/2] git-gui: fix applying line/ranges when the selection ends at the begin of a line
From: Bert Wesarg @ 2012-01-14 5:26 UTC (permalink / raw)
To: Pat Thoyts; +Cc: git, Bert Wesarg
In-Reply-To: <37339be035746797fcec7634e3560ffcd5b26cf3.1326116492.git.bert.wesarg@googlemail.com>
Hi Pat,
On Mon, Jan 9, 2012 at 14:43, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> Selecting also the trailing newline of a line for staging/unstaging would
> have resulted in also staging/unstaging of the next line.
>
same here, could you please consider pushing this into the 1.7.9
release. I see no point in waiting for the next release.
Thanks.
Bert
^ permalink raw reply
* Re: [PATCH 1/1] git-gui: fix hunk parsing for corner case changes
From: Bert Wesarg @ 2012-01-14 5:25 UTC (permalink / raw)
To: Pat Thoyts; +Cc: git, Bert Wesarg
In-Reply-To: <cccd6193cf3bfe170e14270204d735a842bb8563.1326116492.git.bert.wesarg@googlemail.com>
Hi Pat,
On Mon, Jan 9, 2012 at 14:43, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> The simple hunk parsing code did not recognize hunks when there is no
> second number after the comma. Like in these cases:
>
> @@ -1 +0,0 @@
> -1
>
> Which resulted in this hunk header:
>
> @@ -1 +0,1 +1 +0,0 @@
>
> Or:
>
> @@ -1 +1 @@
> -1
> +2
>
> Resulted in:
>
> @@ -1 +1 @@
> ,1 +1 +1 @@
> ,0 @@
>
> While trying to stage only the '-1' line.
>
could you please consider pushing this into the 1.7.9 release. I see
no point in waiting for the next release.
Thanks.
Bert
^ permalink raw reply
* difftool / mergetool waiting
From: Jonathan Seng @ 2012-01-14 5:13 UTC (permalink / raw)
To: git
Hello,
I would like an option to difftool and mergetool that would control
waiting for a return code from the difftool: wait.
Like prompt, wait would be configurable with the difftool.name.
Like prompt and for backwards compatibility, wait would default true.
If wait is false, prompt would be overridden to be false.
If wait is false, git would fire off the tool command and proceed to
the next then exit cleanly.
If wait is true, git would behave as now: it will wait for an exit
code of each tool execution before proceeding.
Thank you,
Jonathan
^ permalink raw reply
* Re: [PATCH v4 00/10] nd/clone-detached
From: Nguyen Thai Ngoc Duy @ 2012-01-14 4:48 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvcofxtv8.fsf@alter.siamese.dyndns.org>
2012/1/14 Junio C Hamano <gitster@pobox.com>:
> Thanks, replaced (and updated comment strings read much better).
>
> There were some conlicts I had to resolve while merging this to 'pu'.
> I would appreciate it if you can eyeball it to make sure I didn't make
> silly mistakes there.
Right, the conflict with nd/clone-single-branch. I kept thinking there
would not be conflict because clone-single-branch's big change was in
wanted_peer_refs() and missed write_followtags() call. The merge looks
good.
--
Duy
^ permalink raw reply
* Re: SVN -> Git *but* with special changes
From: Abscissa @ 2012-01-14 3:43 UTC (permalink / raw)
To: git
In-Reply-To: <1326405138283-7181897.post@n2.nabble.com>
Someone on a different message board noticed that it seemed like it was
trying to strip and already-stripped path in git-svn.perl, so I went in
there, changed the "die" to "print", and after a "make && sudo make install"
it seems to work fine now. Probably not the proper way to fix it, but it
seems to work for me.
It does now fail to delete directories once they actually *are* deleted in
the SVN repo, which is kinda sloppy, but it doesn't hurt anything, so I can
live with that.
--
View this message in context: http://git.661346.n2.nabble.com/SVN-Git-but-with-special-changes-tp6840904p7186699.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply
* Re: Sending patches with KMail (Re: [PATCH] git-blame.el: Fix compilation warnings.)
From: Junio C Hamano @ 2012-01-14 0:59 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Rüdiger Sonderfeld, git, davidk, Sergei Organov, Kevin Ryde,
Michele Ballabio
In-Reply-To: <20120113233158.GD7343@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
> The hints at [1] might also be useful, in case you would like to try
> and consider improving the manpage to document them if they work.
Don't you need similar updates to sections for other MUAs and procedures?
I suspect that the reason why you added the new text there is because you
know KMail users are very lazy bunch, and once they see a "KMail"
subsection, they will skip everything outside the subsection. Thunderbird
users would also be lazy---after choosing one of the three approaches
presented, they will skip anything outside the subsubsection. So I can
understand that we would need something in these individual subsections,
but the advice does not logically belong there.
Perhaps rephrasing the early part of the Discussion section, with an
illustration that is designed to be more visible, would be a better
approach?
For example, we could take your log message and stuff it there:
The opening "From " line and following lines in "git format-patch" are
for your mailer and should be omitted except for fields that differ from
the mail header when reading your patch into an email body. For example,
the output of your format-patch may begin like this:
From 13c41b41b832d41680ccd33a2422ef8217965566 Mon Sep 17 00:00:00 2001
From: Jonathan Nieder <jrnieder@gmail.com>
Date: Fri, 13 Jan 2012 17:22:41 -0600
Subject: Documentation/format-patch: mention removal of in-body headers
The opening "From " line and following lines in ...
The part you should send in the body of your e-mail message begins at the
first blank line. The "From $SHA1 $magic_timestamp" line and other header
lines are there to make it look like a mbox, and if you send it in e-mail,
they will become redundant.
You can leave "From:" and/or "Subject:" lines in, if they are
different from the e-mail you will be sending out (e.g. you are
forwarding a patch written by somebody else, as a follow up to an
ongoing discussion and do not want the subject of your e-mail message
to help threading). E.g. your message _may_ begin like this:
From: Jonathan Nieder <jrnieder@gmail.com>
Subject: Documentation/format-patch: mention removal of in-body headers
The opening "From " line and following lines in ...
when you are not Jonathan, and you are sending it as a response to
an existing discussion thread.
Or something like that?
^ permalink raw reply
* Sending patches with KMail (Re: [PATCH] git-blame.el: Fix compilation warnings.)
From: Jonathan Nieder @ 2012-01-13 23:31 UTC (permalink / raw)
To: Rüdiger Sonderfeld
Cc: git, davidk, Sergei Organov, Kevin Ryde, Michele Ballabio
In-Reply-To: <2304907.sEfEeC6Eon@descartes>
Hi,
Rüdiger Sonderfeld wrote:
> On Thursday 12 January 2012 10:26:41 Jonathan Nieder wrote:
>> These lines should be left out [*].
>
> Sorry, I wasn't sure whether to remove them or not. I followed the description
> in git-format-patch(1) on how to send patches with kmail. I'll remove them in
> the future. Thanks for the advice.
Oh, thanks for the pointer. How about something like this?
The hints at [1] might also be useful, in case you would like to try
and consider improving the manpage to document them if they work.
-- >8 --
Subject: Documentation/format-patch: mention removal of in-body headers for KMail
The opening "From " line and following lines in "git format-patch"
From 13c41b41b832d41680ccd33a2422ef8217965566 Mon Sep 17 00:00:00 2001
From: Jonathan Nieder <jrnieder@gmail.com>
Date: Fri, 13 Jan 2012 17:22:41 -0600
are for your mailer and should be omitted except for fields that
differ from the mail header when reading your patch into an email
body. Otherwise "git am" thinks these lines are part of the commit
message when trying to reproduce the resulting patch from an mbox
automatically. Add a reminder in this direction to the KMail recipe.
Suggested-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
[1] http://thread.gmane.org/gmane.comp.version-control.git/171580/focus=171720
Documentation/git-format-patch.txt | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 6ea9be77..5e1d6d2c 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -462,8 +462,10 @@ This should help you to submit patches inline using KMail.
4. Use Message -> Insert file... and insert the patch.
-5. Back in the compose window: add whatever other text you wish to the
- message, complete the addressing and subject fields, and press send.
+5. Back in the compose window: remove the "`From $SHA1 $magic_timestamp`"
+ marker and unwanted in-body headers, add whatever other text you wish
+ to the message, complete the addressing and subject fields, and
+ press send.
EXAMPLES
--
1.7.8.3
^ permalink raw reply related
* Re: [RFC][PATCH v3] git on Mac OS and precomposed unicode
From: Jonathan Nieder @ 2012-01-13 22:56 UTC (permalink / raw)
To: tb; +Cc: gitster, git
In-Reply-To: <201201132253.00799.tboegi@web.de>
Hi,
tb wrote:
> Purpose:
[...]
> Runtime configuration:
[...]
> Implementation:
[...]
> Compile time configuration:
[...]
> Implementation details:
[....]
> Thread safety:
[...]
> Auto sensing:
[...]
> New test case:
This information, to the extent that it is useful at all, belongs in
the commit log. That is, the commit message should concisely say
everything a person would want to know when reading a patch, whether
reading it to review it for inclusion, to make sure it still works
when making a related change, to consider whether it is safe to
upgrade to a version including the change, to understand what is
happening when a bug is tracked down to be caused by that commit, or
for some other reason.
So please do not use a cover letter that separates this information
when sending a single patch.
> Changes since [...]
This kind of information that does not belong in the commit message
can go after the "---" in the same message as the patch.
I haven't read the patch yet, except to glance at it and see some
nitpicks I can mention later (e.g., source files should not #include
anything else before git-compat-util.h or cache.h), and the approach
seems likely to be sane; I'm mentioning this to help you present the
information in a way that can save myself and other reviewers some
trouble for the next round.
Thanks much for your work, and hope that helps.
Regards,
Jonathan
^ permalink raw reply
* [RFC][PATCH v3] git on Mac OS and precomposed unicode
From: tb @ 2012-01-13 21:53 UTC (permalink / raw)
To: gitster, git; +Cc: tboegi
Allow git on Mac OS to store file names in the index in precomposed unicode,
while the file system used decomposed unicode.
When a file called "LATIN CAPITAL LETTER A WITH DIAERESIS"
(in utf-8 encoded as 0xc3 0x84) is created,
the filesystem converts "precomposed unicode" into "decomposed unicode",
which means that readdir() will return 0x41 0xcc 0x88.
When true, git reverts the unicode decomposition of filenames.
This is useful when pulling/pushing from repositories containing utf-8
encoded filenames using precomposed utf-8 (like Linux).
This feature is automatically switched on when "git init" is run,
and the file system is doing UTF-8 decompostion.
(Which has been observed on HFS+, SMBFS and VFAT, but not on NFS)
It can be switched off by setting core.macosforcenfc=false
It is implemented by re-defining the readdir() functions.
File names are converted into precomposed UTF-8.
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
Documentation/config.txt | 9 ++
Makefile | 3 +
builtin/init-db.c | 2 +
compat/precomposed_utf8.c | 213 ++++++++++++++++++++++++++++++++++++++++++
compat/precomposed_utf8.h | 39 ++++++++
git-compat-util.h | 9 ++
git.c | 1 +
t/t0050-filesystem.sh | 1 +
t/t3910-mac-os-precompose.sh | 117 +++++++++++++++++++++++
9 files changed, 394 insertions(+), 0 deletions(-)
create mode 100644 compat/precomposed_utf8.c
create mode 100644 compat/precomposed_utf8.h
create mode 100755 t/t3910-mac-os-precompose.sh
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 2959390..01b9465 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -175,6 +175,15 @@ The default is false, except linkgit:git-clone[1] or linkgit:git-init[1]
will probe and set core.ignorecase true if appropriate when the repository
is created.
+core.precomposedunicode::
+ This option is only used by Mac OS implementation of git.
+ When core.precomposedunicode=true,
+ git reverts the unicode decomposition of filenames done by Mac OS.
+ This is useful when pulling/pushing from repositories containing utf-8
+ encoded filenames using precomposed unicode (like Linux).
+ When false, file names are handled fully transparent by git.
+ If in doubt, set core.precomposedunicode=false.
+
core.trustctime::
If false, the ctime differences between the index and the
working tree are ignored; useful when the inode change time
diff --git a/Makefile b/Makefile
index b21d2f1..a912b45 100644
--- a/Makefile
+++ b/Makefile
@@ -519,6 +519,7 @@ LIB_H += compat/bswap.h
LIB_H += compat/cygwin.h
LIB_H += compat/mingw.h
LIB_H += compat/obstack.h
+LIB_H += compat/precomposed_utf8.h
LIB_H += compat/win32/pthread.h
LIB_H += compat/win32/syslog.h
LIB_H += compat/win32/poll.h
@@ -884,6 +885,8 @@ ifeq ($(uname_S),Darwin)
endif
NO_MEMMEM = YesPlease
USE_ST_TIMESPEC = YesPlease
+ COMPAT_OBJS += compat/precomposed_utf8.o
+ BASIC_CFLAGS += -DPRECOMPOSED_UNICODE
endif
ifeq ($(uname_S),SunOS)
NEEDS_SOCKET = YesPlease
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 0dacb8b..06953df 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -290,6 +290,8 @@ static int create_default_files(const char *template_path)
strcpy(path + len, "CoNfIg");
if (!access(path, F_OK))
git_config_set("core.ignorecase", "true");
+
+ probe_utf8_pathname_composition(path, len);
}
return reinit;
diff --git a/compat/precomposed_utf8.c b/compat/precomposed_utf8.c
new file mode 100644
index 0000000..46d35af
--- /dev/null
+++ b/compat/precomposed_utf8.c
@@ -0,0 +1,213 @@
+#define __PRECOMPOSED_UNICODE_C__
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include "../cache.h"
+#include "../utf8.h"
+
+#include "precomposed_utf8.h"
+
+static int mac_os_precomposed_unicode;
+const static char *repo_encoding = "UTF-8";
+const static char *path_encoding = "UTF-8-MAC";
+
+
+/* Code borrowed from utf8.c */
+#if defined(OLD_ICONV) || (defined(__sun__) && !defined(_XPG6))
+ typedef const char * iconv_ibp;
+#else
+ typedef char * iconv_ibp;
+#endif
+
+static char *reencode_string_iconv(const char *in, size_t insz, iconv_t conv)
+{
+ size_t outsz, outalloc;
+ char *out, *outpos;
+ iconv_ibp cp;
+
+ outsz = insz;
+ outalloc = outsz + 1; /* for terminating NUL */
+ out = xmalloc(outalloc);
+ outpos = out;
+ cp = (iconv_ibp)in;
+
+ while (1) {
+ size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
+
+ if (cnt == -1) {
+ size_t sofar;
+ if (errno != E2BIG) {
+ free(out);
+ return NULL;
+ }
+ /* insz has remaining number of bytes.
+ * since we started outsz the same as insz,
+ * it is likely that insz is not enough for
+ * converting the rest.
+ */
+ sofar = outpos - out;
+ outalloc = sofar + insz * 2 + 32;
+ out = xrealloc(out, outalloc);
+ outpos = out + sofar;
+ outsz = outalloc - sofar - 1;
+ }
+ else {
+ *outpos = '\0';
+ break;
+ }
+ }
+ return out;
+}
+
+static size_t has_utf8(const char *s, size_t maxlen, size_t *strlen_c)
+{
+ const uint8_t *utf8p = (const uint8_t*) s;
+ size_t strlen_chars = 0;
+ size_t ret = 0;
+
+ if ((!utf8p) || (!*utf8p))
+ return 0;
+
+ while((*utf8p) && maxlen) {
+ if (*utf8p & 0x80)
+ ret++;
+ strlen_chars++;
+ utf8p++;
+ maxlen--;
+ }
+ if (strlen_c)
+ *strlen_c = strlen_chars;
+
+ return ret;
+}
+
+
+void probe_utf8_pathname_composition(char *path, int len)
+{
+ const static char *auml_nfc = "\xc3\xa4";
+ const static char *auml_nfd = "\x61\xcc\x88";
+ int output_fd;
+ path[len] = 0;
+ strcpy(path + len, auml_nfc);
+ output_fd = open(path, O_CREAT|O_EXCL|O_RDWR, 0600);
+ if (output_fd >=0) {
+ close(output_fd);
+ path[len] = 0;
+ strcpy(path + len, auml_nfd);
+ if (0 == access(path, R_OK))
+ git_config_set("core.precomposedunicode", "true");
+ else
+ git_config_set("core.precomposedunicode", "false");
+ path[len] = 0;
+ strcpy(path + len, auml_nfc);
+ unlink(path);
+ }
+}
+
+
+static int precomposed_unicode_config(const char *var, const char *value, void *cb)
+{
+ if (!strcasecmp(var, "core.precomposedunicode")) {
+ mac_os_precomposed_unicode = git_config_bool(var, value);
+ return 0;
+ }
+ return 1;
+}
+
+void argv_precompose(int argc, const char **argv)
+{
+ int i = 0;
+ const char *oldarg;
+ char *newarg;
+ iconv_t ic_precompose;
+
+ git_config(precomposed_unicode_config, NULL);
+ if (!mac_os_precomposed_unicode)
+ return;
+
+ ic_precompose = iconv_open(repo_encoding, path_encoding);
+ if (ic_precompose == (iconv_t) -1)
+ return;
+
+ while (i < argc) {
+ size_t namelen;
+ oldarg = argv[i];
+ if (has_utf8(oldarg, (size_t)-1, &namelen)) {
+ newarg = reencode_string_iconv(oldarg, namelen, ic_precompose);
+ if (newarg)
+ argv[i] = newarg;
+ }
+ i++;
+ }
+ iconv_close(ic_precompose);
+}
+
+
+PRECOMPOSED_UTF_DIR * precomposed_utf8_opendir(const char *dirname)
+{
+ PRECOMPOSED_UTF_DIR *precomposed_utf8_dir;
+ precomposed_utf8_dir = malloc(sizeof(PRECOMPOSED_UTF_DIR));
+ if (!precomposed_utf8_dir)
+ return NULL;
+
+ precomposed_utf8_dir->dirp = opendir(dirname);
+ if (!precomposed_utf8_dir->dirp) {
+ free(precomposed_utf8_dir);
+ return NULL;
+ }
+ precomposed_utf8_dir->ic_precompose = iconv_open(repo_encoding, path_encoding);
+ if (precomposed_utf8_dir->ic_precompose == (iconv_t) -1) {
+ closedir(precomposed_utf8_dir->dirp);
+ free(precomposed_utf8_dir);
+ return NULL;
+ }
+
+ return precomposed_utf8_dir;
+}
+
+struct dirent * precomposed_utf8_readdir(PRECOMPOSED_UTF_DIR *precomposed_utf8_dirp)
+{
+ struct dirent *res;
+ size_t namelen = 0;
+
+ res = readdir(precomposed_utf8_dirp->dirp);
+ if (!res || !mac_os_precomposed_unicode || !has_utf8(res->d_name, (size_t)-1, &namelen))
+ return res;
+ else {
+ int olderrno = errno;
+ size_t outsz = sizeof(precomposed_utf8_dirp->dirent_nfc.d_name) - 1; /* one for \0 */
+ char *outpos = precomposed_utf8_dirp->dirent_nfc.d_name;
+ iconv_ibp cp;
+ size_t cnt;
+ size_t insz = namelen;
+ cp = (iconv_ibp)res->d_name;
+
+ /* Copy all data except the name */
+ memcpy(&precomposed_utf8_dirp->dirent_nfc, res,
+ sizeof(precomposed_utf8_dirp->dirent_nfc)-sizeof(precomposed_utf8_dirp->dirent_nfc.d_name));
+ errno = 0;
+
+ cnt = iconv(precomposed_utf8_dirp->ic_precompose, &cp, &insz, &outpos, &outsz);
+ if (cnt < sizeof(precomposed_utf8_dirp->dirent_nfc.d_name) -1) {
+ *outpos = 0;
+ errno = olderrno;
+ return &precomposed_utf8_dirp->dirent_nfc;
+ }
+ errno = olderrno;
+ return res;
+ }
+}
+
+
+int precomposed_utf8_closedir(PRECOMPOSED_UTF_DIR *precomposed_utf8_dirp)
+{
+ int ret_value;
+ ret_value = closedir(precomposed_utf8_dirp->dirp);
+ if (precomposed_utf8_dirp->ic_precompose != (iconv_t)-1)
+ iconv_close(precomposed_utf8_dirp->ic_precompose);
+ free(precomposed_utf8_dirp);
+ return ret_value;
+}
diff --git a/compat/precomposed_utf8.h b/compat/precomposed_utf8.h
new file mode 100644
index 0000000..3eca7b9
--- /dev/null
+++ b/compat/precomposed_utf8.h
@@ -0,0 +1,39 @@
+#ifndef __PRECOMPOSED_UNICODE_H__
+#if defined (PRECOMPOSED_UNICODE)
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <iconv.h>
+
+
+typedef struct {
+ iconv_t ic_precompose;
+ DIR *dirp;
+ struct dirent dirent_nfc;
+} PRECOMPOSED_UTF_DIR;
+
+char *str_precompose(const char *in, iconv_t ic_precompose);
+void argv_precompose(int argc, const char **argv);
+void probe_utf8_pathname_composition(char *, int);
+
+PRECOMPOSED_UTF_DIR *precomposed_utf8_opendir(const char *dirname);
+struct dirent *precomposed_utf8_readdir(PRECOMPOSED_UTF_DIR *dirp);
+int precomposed_utf8_closedir(PRECOMPOSED_UTF_DIR *dirp);
+
+#ifndef __PRECOMPOSED_UNICODE_C__
+
+#define opendir(n) precomposed_utf8_opendir(n)
+#define readdir(d) precomposed_utf8_readdir(d)
+#define closedir(d) precomposed_utf8_closedir(d)
+#define DIR PRECOMPOSED_UTF_DIR
+#endif /* __PRECOMPOSED_UNICODE_C__ */
+
+#else
+
+#define str_precompose(in,i_nfd2nfc) (NULL)
+#define argv_precompose(c,v)
+#define probe_utf8_pathname_composition(a,b)
+#endif /* PRECOMPOSED_UNICODE */
+
+#define __PRECOMPOSED_UNICODE_H__
+#endif /* __PRECOMPOSED_UNICODE_H__ */
diff --git a/git-compat-util.h b/git-compat-util.h
index 230e198..708b178 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -90,6 +90,15 @@
#include <windows.h>
#endif
+#if defined (PRECOMPOSED_UNICODE)
+#include "compat/precomposed_utf8.h"
+#else
+#define str_precompose(in,i_nfd2nfc) (NULL)
+#define argv_precompose(c,v)
+#define probe_utf8_pathname_composition(a,b)
+
+#endif
+
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
diff --git a/git.c b/git.c
index 8e34903..6b2ffb7 100644
--- a/git.c
+++ b/git.c
@@ -298,6 +298,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
startup_info->have_repository) /* get_git_dir() may set up repo, avoid that */
trace_repo_setup(prefix);
}
+ argv_precompose(argc, argv);
commit_pager_choice();
if (!help && p->option & NEED_WORK_TREE)
diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index 1542cf6..befe39e 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -126,6 +126,7 @@ test_expect_success "setup unicode normalization tests" '
test_create_repo unicode &&
cd unicode &&
+ git config core.precomposedunicode false &&
touch "$aumlcdiar" &&
git add "$aumlcdiar" &&
git commit -m initial &&
diff --git a/t/t3910-mac-os-precompose.sh b/t/t3910-mac-os-precompose.sh
new file mode 100755
index 0000000..439e266
--- /dev/null
+++ b/t/t3910-mac-os-precompose.sh
@@ -0,0 +1,117 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Torsten Bögershausen
+#
+
+test_description='utf-8 decomposed (nfd) converted to precomposed (nfc)'
+
+. ./test-lib.sh
+
+Adiarnfc=`printf '\303\204'`
+Odiarnfc=`printf '\303\226'`
+Adiarnfd=`printf 'A\314\210'`
+Odiarnfd=`printf 'O\314\210'`
+
+mkdir junk &&
+>junk/"$Adiarnfc" &&
+case "$(cd junk && echo *)" in
+ "$Adiarnfd")
+ test_nfd=1
+ ;;
+ *) ;;
+esac
+rm -rf junk
+
+if test "$test_nfd"
+then
+ test_expect_success "detect if nfd needed" '
+ precomposedunicode=`git config --bool core.precomposedunicode` &&
+ test "$precomposedunicode" = true
+ '
+ test_expect_success "setup" '
+ >x &&
+ git add x &&
+ git commit -m "1st commit" &&
+ git rm x &&
+ git commit -m "rm x"
+ '
+ test_expect_success "setup case mac" '
+ git checkout -b mac_os
+ '
+ # This will test nfd2nfc in readdir()
+ test_expect_success "add file Adiarnfc" '
+ echo f.Adiarnfc >f.$Adiarnfc &&
+ git add f.$Adiarnfc &&
+ git commit -m "add f.$Adiarnfc"
+ '
+ # This will test nfd2nfc in git stage()
+ test_expect_success "stage file d.Adiarnfd/f.Adiarnfd" '
+ mkdir d.$Adiarnfd &&
+ echo d.$Adiarnfd/f.$Adiarnfd >d.$Adiarnfd/f.$Adiarnfd &&
+ git stage d.$Adiarnfd/f.$Adiarnfd &&
+ git commit -m "add d.$Adiarnfd/f.$Adiarnfd"
+ '
+ test_expect_success "add link Adiarnfc" '
+ ln -s d.$Adiarnfd/f.$Adiarnfd l.$Adiarnfc &&
+ git add l.$Adiarnfc &&
+ git commit -m "add l.Adiarnfc"
+ '
+ # This will test git log
+ test_expect_success "git log f.Adiar" '
+ git log f.$Adiarnfc > f.Adiarnfc.log &&
+ git log f.$Adiarnfd > f.Adiarnfd.log &&
+ test -s f.Adiarnfc.log &&
+ test -s f.Adiarnfd.log &&
+ test_cmp f.Adiarnfc.log f.Adiarnfd.log &&
+ rm f.Adiarnfc.log f.Adiarnfd.log
+ '
+ # This will test git ls-files
+ test_expect_success "git lsfiles f.Adiar" '
+ git ls-files f.$Adiarnfc > f.Adiarnfc.log &&
+ git ls-files f.$Adiarnfd > f.Adiarnfd.log &&
+ test -s f.Adiarnfc.log &&
+ test -s f.Adiarnfd.log &&
+ test_cmp f.Adiarnfc.log f.Adiarnfd.log &&
+ rm f.Adiarnfc.log f.Adiarnfd.log
+ '
+ # This will test git mv
+ test_expect_success "git mv" '
+ git mv f.$Adiarnfd f.$Odiarnfc &&
+ git mv d.$Adiarnfd d.$Odiarnfc &&
+ git mv l.$Adiarnfd l.$Odiarnfc &&
+ git commit -m "mv Adiarnfd Odiarnfc"
+ '
+ # Files can be checked out as nfc
+ # And the link has been corrected from nfd to nfc
+ test_expect_success "git checkout nfc" '
+ rm f.$Odiarnfc &&
+ git checkout f.$Odiarnfc
+ '
+ # Make it possible to checkout files with their NFD names
+ test_expect_success "git checkout file nfd" '
+ rm -f f.* &&
+ git checkout f.$Odiarnfd
+ '
+ # Make it possible to checkout links with their NFD names
+ test_expect_success "git checkout link nfd" '
+ rm l.* &&
+ git checkout l.$Odiarnfd
+ '
+ test_expect_success "setup case mac2" '
+ git checkout master &&
+ git reset --hard &&
+ git checkout -b mac_os_2
+ '
+ # This will test nfd2nfc in git commit
+ test_expect_success "commit file d2.Adiarnfd/f.Adiarnfd" '
+ mkdir d2.$Adiarnfd &&
+ echo d2.$Adiarnfd/f.$Adiarnfd >d2.$Adiarnfd/f.$Adiarnfd &&
+ git add d2.$Adiarnfd/f.$Adiarnfd &&
+ git commit -m "add d2.$Adiarnfd/f.$Adiarnfd" -- d2.$Adiarnfd/f.$Adiarnfd
+ '
+else
+ say "Skipping nfc/nfd tests"
+fi
+ #git commit -m "add d2.$Adiarnfd/f.$Adiarnfd" -- d2.$Adiarnfd/f.$Adiarnfd
+
+test_done
--
1.7.8.rc0.43.gb49a8
^ permalink raw reply related
* [RFC][PATCH v3] git on Mac OS and precomposed unicode
From: tb @ 2012-01-13 21:53 UTC (permalink / raw)
To: gitster, git; +Cc: tboegi
Changes since V2:
- renamed compat/darwin.[ch] into compat/precomposed_utf8.[ch]
- builtin/init-db.c: use probe_utf8_pathname_composition()
- fix in reencode_string_iconv(): Don't call iconv_close()
- Allways convert all arguments, no special handling for "git commit"
Changes since last version:
- Improved testcase t/t3910-mac-os-precompose.sh:
test "git commit -- pathspec" (Thanks Junio)
- Improved the converting of argv[] for "git commit"
===============
Purpose:
This patch is a suggestion to work around the unpleasenties
when Mac OS is decomposing unicode filenames.
The suggested change:
a) is only used under Mac OS
b) can be switched off by a configuration variable
c) is optimized to handle ASCII only filename
d) will improve the interwork between Mac OS, Linux and Windows*
via git push/pull, using USB sticks (technically speaking VFAT)
or mounted network shares using samba.
* (Not all Windows versions support UTF-8 yet:
Msysgit needs the unicode branch, cygwin supports UTF-8 since 1.7)
Runtime configuration:
A new confguration variable is added: "core.precomposedunicode"
This variable is only used on Mac OS.
If set to false, git behaves exactly as older versions of git.
When a new git version is installed and there is a repository
where the configuration "core.precomposedunicode" is not present,
the new git is backward compatible.
When core.precomposedunicode=true, all filenames are stored in precomposed
unicode in the index (technically speaking precomposed UTF-8).
Even when readdir() under Mac OS returns filenames as decomposed.
Implementation:
Two files are added to the "compat" directory, darwin.h and darwin.c.
They implement basically 4 new functions:
precomposed_utf8_opendir(), precomposed_utf8_readdir(),
precomposed_utf8_closedir() argv_precompose()
Compile time configuration:
A new compiler option PRECOMPOSED_UNICODE is introduced in the Makefile,
so that the patch can be switched off completely at compile time.
No decomposed file names in a git repository:
In order to prevent that ever a file name in decomposed unicode is entering
the index, a "brute force" attempt is taken:
all arguments into git (technically argv[1]..argv[n]) are converted into
precomposed unicode.
This is done in git.c by calling argv_precompose().
This function is actually a #define, and it is only defined under Mac OS.
Nothing is converted on any other OS.
Implementation details:
The main work is done in precomposed_utf8_readdir() and argv_precompose().
The conversion into precomposed unicode is done by using iconv,
where decomposed is denoted by "UTF-8-MAC" and precomposed is "UTF-8".
When already precomposed unicode is precomposed, the string is returned
unchanged.
Thread save:
Since there is no need for argv_precompose()to be thread-save, one iconv
instance is created at the beginning and kept for all conversions.
Even readdir() is not thread-save, so that precomposed_utf8_opendir() will call
iconv_open() once and keep the instance for all calls of precomposed_utf8_readdir()
until precomposed_utf8_close() is called.
Auto sensing:
When creating a new git repository with "git init" or "git clone", the
"core.precomposedunicode" will be set automatically to "true" or "false".
Typically core.precomposedunicode is "true" on HFS and VFAT.
It is even true for file systems mounted via SAMBA onto a Linux box,
and "false" for drives mounted via NFS onto a Linux box.
New test case:
The new t3910-mac-os-precompose.sh is added to check if a filename
can be reached either in precomposed or decomposed unicode (NFC or NFD).
Torsten Bögershausen (1):
git on Mac OS and precomposed unicode
Documentation/config.txt | 9 ++
Makefile | 3 +
builtin/init-db.c | 2 +
compat/precomposed_utf8.c | 213 ++++++++++++++++++++++++++++++++++++++++++
compat/precomposed_utf8.h | 39 ++++++++
git-compat-util.h | 9 ++
git.c | 1 +
t/t0050-filesystem.sh | 1 +
t/t3910-mac-os-precompose.sh | 117 +++++++++++++++++++++++
9 files changed, 394 insertions(+), 0 deletions(-)
create mode 100644 compat/precomposed_utf8.c
create mode 100644 compat/precomposed_utf8.h
create mode 100755 t/t3910-mac-os-precompose.sh
--
1.7.8.rc0.43.gb49a8
^ permalink raw reply
* Re: [RFC][PATCH v2] git on Mac OS and precomposed unicode
From: Torsten Bögershausen @ 2012-01-13 21:52 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, tb
In-Reply-To: <7vd3asejrr.fsf@alter.siamese.dyndns.org>
On 01/09/2012 08:52 PM, Junio C Hamano wrote:
[snip]
>probe_utf8_pathname_composition(path, len);
Done
[snip]
>and implementation of the function body in compat/darwin.c (Didn't I see a
>comment on the name of this file, by the way? What was the conclusion of
> the discussion?).
I renamed the compat/darwin.[ch] into compat/precomposed_utf8.[ch]
>> +{
>> + int i = 0;
>> + int first_arg = 0; /* convert everything */
>> + const char *oldarg;
>> + char *newarg;
>> + iconv_t ic_precompose;
>> +
>> + git_config(precomposed_unicode_config, NULL);
>
> Hmmmmm. Is it safe to call git_config() this early in the program? Have
> we determined if we are in a git managed repository and where its $GIT_DIR
> is?
>
According to my understanding, yes:
git_config is called with the custom function precomposed_unicode_config():
git_config(precomposed_unicode_config, NULL);
where
precomposed_unicode_config()
fishes for the config variable "core.precomposedunicode" and puts the
result into
int precomposed_unicode_config.
After that, when precomposed_unicode_config==0, argv_precomposed() will
return.
I'll send the V3 RFC/PATCH
/Torsten
^ permalink raw reply
* Commit changes to remote repository
From: ruperty @ 2012-01-13 20:29 UTC (permalink / raw)
To: git
Being new to git I am probably not doing things correctly so pointers in the
right direction would be useful.
What I want to do make changes on my laptop and commit them to a remote
repository. Here is what I have done,
1. Created a repository on my remote linux host, in a folder of cource code,
by,
git init
git add *
git commit
2. On my laptop I did a git clone pointing by ssh to the remote repo which
downloaded all the files to my local system.
3. I changed a file locally and did a commit.
4. I then wanted to update the remote repo with my change, which I did with
a git push, but that didn't work, getting this error,
remote: error: refusing to update checked out branch:
refs/heads/master^[[K
remote: error: By default, updating the current branch in a non-bare
repository^[[K.......
What am I doing wrong?
I was following the tutorial at
http://book.git-scm.com/3_distributed_workflows.html
I did search for this issue in this list but didn't understand the
responses.
Rupert
--
View this message in context: http://git.661346.n2.nabble.com/Commit-changes-to-remote-repository-tp7185551p7185551.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply
* [ANNOUNCE] Git 1.7.9.rc1
From: Junio C Hamano @ 2012-01-13 19:55 UTC (permalink / raw)
To: git; +Cc: Linux Kernel
A release candidate Git 1.7.9.rc1 is available for testing.
The release tarballs are found at:
http://code.google.com/p/git-core/downloads/list
and their SHA-1 checksums are:
b97f10508f16b4117499cdfc4df9b19c725027d5 git-1.7.9.rc1.tar.gz
3064fc295a46440a91ca3f5fa622f5f1d40d3ba4 git-htmldocs-1.7.9.rc1.tar.gz
332e12061823d8def0fb823fa7798093bbe41279 git-manpages-1.7.9.rc1.tar.gz
Also the following public repositories all have a copy of the v1.7.9.rc1
tag and the master branch that the tag points at:
url = git://repo.or.cz/alt-git.git
url = https://code.google.com/p/git-core/
url = git://git.sourceforge.jp/gitroot/git-core/git.git
url = git://git-core.git.sourceforge.net/gitroot/git-core/git-core
url = https://github.com/gitster/git
Git v1.7.9 Release Notes (draft)
========================
Updates since v1.7.8
--------------------
* gitk updates accumulated since early 2011.
* git-gui updated to 0.16.0.
* git-p4 (in contrib/) updates.
* Git uses gettext to translate its most common interface messages
into the user's language if translations are available and the
locale is appropriately set. Distributors can drop in new PO files
in po/ to add new translations.
* The code to handle username/password for HTTP transaction used in
"git push" & "git fetch" learned to talk "credential API" to
external programs to cache or store them, to allow integration with
platform native keychain mechanisms.
* The prompted input in the terminal use our own getpass() replacement
when possible. HTTP transactions used to ask username without echoing
back what was typed, but with this change you will see it as you type.
* The internal of "revert/cherry-pick" has been tweaked to prepare
building more generic "sequencer" on top of the implementation that
drives them.
* "git rev-parse FETCH_HEAD" after "git fetch" without specifying
what to fetch from the command line will now show the commit that
would be merged if the command were "git pull".
* "git add" learned to stream large files directly into a packfile
instead of writing them into individual loose object files.
* "git checkout -B <current branch> <elsewhere>" is a more intuitive
way to spell "git reset --keep <elsewhere>".
* "git checkout" and "git merge" learned "--no-overwrite-ignore" option
to tell Git that untracked and ignored files are not expendable.
* "git commit --amend" learned "--no-edit" option to say that the
user is amending the tree being recorded, without updating the
commit log message.
* "git commit" and "git reset" re-learned the optimization to prime
the cache-tree information in the index, which makes it faster to
write a tree object out after the index entries are updated.
* "git commit" detects and rejects an attempt to stuff NUL byte in
the commit log message.
* "git commit" learned "-S" to GPG-sign the commit; this can be shown
with the "--show-signature" option to "git log".
* fsck and prune are relatively lengthy operations that still go
silent while making the end-user wait. They learned to give progress
output like other slow operations.
* The set of built-in function-header patterns for various languages
knows MATLAB.
* "git log --format='<format>'" learned new %g[nNeE] specifiers to
show information from the reflog entries when warlking the reflog
(i.e. with "-g").
* "git pull" can be used to fetch and merge an annotated/signed tag,
instead of the tip of a topic branch. The GPG signature from the
signed tag is recorded in the resulting merge commit for later
auditing.
* "git log" learned "--show-signature" option to show the signed tag
that was merged that is embedded in the merge commit. It also can
show the signature made on the commit with "git commit -S".
* "git branch --edit-description" can be used to add descriptive text
to explain what a topic branch is about.
* "git fmt-merge-msg" learned to take the branch description into
account when preparing a merge summary that "git merge" records
when merging a local branch.
* "git request-pull" has been updated to convey more information
useful for integrators to decide if a topic is worth merging and
what is pulled is indeed what the requestor asked to pull,
including:
- the tip of the branch being requested to be merged;
- the branch description describing what the topic is about;
- the contents of the annotated tag, when requesting to pull a tag.
* "git pull" learned to notice 'pull.rebase' configuration variable,
which serves as a global fallback for setting 'branch.<name>.rebase'
configuration variable per branch.
* "git tag" learned "--cleanup" option to control how the whitespaces
and empty lines in tag message are cleaned up.
* "gitweb" learned to show side-by-side diff.
Also contains minor documentation updates and code clean-ups.
Fixes since v1.7.8
------------------
Unless otherwise noted, all the fixes since v1.7.8 in the maintenance
releases are contained in this release (see release notes to them for
details).
----------------------------------------------------------------
Changes since v1.7.9-rc0 are as follows:
Ben Walton (1):
Use perl instead of sed for t8006-blame-textconv test
Carlos Martín Nieto (1):
archive: re-allow HEAD:Documentation on a remote invocation
Clemens Buchacher (1):
credentials: unable to connect to cache daemon
Jeff King (5):
send-email: multiedit is a boolean config option
attr: don't confuse prefixes with leading directories
attr: drop misguided defensive coding
attr: fix leak in free_attr_elem
thin-pack: try harder to use preferred base objects as base
Junio C Hamano (11):
attr.c: make bootstrap_attr_stack() leave early
attr.c: clarify the logic to pop attr_stack
Documentation: rerere's rr-cache auto-creation and rerere.enabled
Prepare for 1.7.6.6
Prepare for 1.7.7.6
Prepare for 1.7.8.4
request-pull: use the real fork point when preparing the message
Update draft release notes to 1.7.6.6
Update draft release notes to 1.7.7.6
Update draft release notes to 1.7.8.4
Git 1.7.9-rc1
Matthieu Moy (1):
gitweb: accept trailing "/" in $project_list
Michael Haggerty (3):
receive-pack: move more work into write_head_info()
show_ref(): remove unused "flag" and "cb_data" arguments
write_head_info(): handle "extra refs" locally
Nguyễn Thái Ngọc Duy (1):
t2203: fix wrong commit command
Sebastian Schuberth (2):
t9200: On MSYS, do not pass Windows-style paths to CVS
git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
Thomas Rast (1):
mailinfo documentation: accurately describe non -k case
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox