Merge branch 'maint'

* maint:
  Update draft release notes for 1.5.0.1
  Convert update-index references in docs to add.
  Attempt to improve git-rebase lead-in description.
  Do not take mode bits from index after type change.
  git-blame: prevent argument parsing segfault
  Make gitk save and restore window pane position on Linux and Cygwin.
  Make gitk save and restore the user set window position.
  [PATCH] gitk: Use show-ref instead of ls-remote
  [PATCH] Make gitk work reasonably well on Cygwin.
  [PATCH] gitk - remove trailing whitespace from a few lines.
  Change git repo-config to git config
This commit is contained in:
Junio C Hamano 2007-02-17 16:16:48 -08:00
commit 69bc0e22d3
17 changed files with 97 additions and 40 deletions

View File

@ -7,14 +7,31 @@ Fixes since v1.5.0
* Documentation updates * Documentation updates
- Clarifications and corrections to 1.5.0 release notes. - Clarifications and corrections to 1.5.0 release notes.
- The main documentation did not link to git-remote documentation. - The main documentation did not link to git-remote documentation.
- Clarified introductory text of git-rebase documentation.
- Converted remaining mentions of update-index on Porcelain
documents to git-add/git-rm.
* Bugfixes * Bugfixes
- git-daemon marks the listening sockets with FD_CLOEXEC so - git-daemon marks the listening sockets with FD_CLOEXEC so
that it won't be leaked into the children. that it won't be leaked into the children.
- segfault from git-blame when the mandatory pathname
parameter was missing was fixed; usage() message is given
instead.
* Tweaks
- sliding mmap() inefficiently mmaped the same region of a
packfile with an access pattern that used objects in the
reverse order. This has been made more efficient.
-- --
O=v1.5.0-7-g37b73cf exec >/var/tmp/1
O=v1.5.0-24-g460ca30
echo O=`git describe maint` echo O=`git describe maint`
git shortlog --no-merges $O.. git shortlog --no-merges $O..maint

View File

@ -106,7 +106,8 @@ directory tree, and renaming a file does not change the object that
file is associated with in any way. file is associated with in any way.
A blob is typically created when gitlink:git-update-index[1] A blob is typically created when gitlink:git-update-index[1]
is run, and its data can be accessed by gitlink:git-cat-file[1]. (or gitlink:git-add[1]) is run, and its data can be accessed by
gitlink:git-cat-file[1].
Tree Object Tree Object
~~~~~~~~~~~ ~~~~~~~~~~~

View File

@ -61,7 +61,8 @@ OPTIONS
+ +
When a merge conflict happens, the index entries for conflicting When a merge conflict happens, the index entries for conflicting
paths are left unmerged, and you need to resolve the conflicts paths are left unmerged, and you need to resolve the conflicts
and mark the resolved paths with `git update-index`. and mark the resolved paths with `git add` (or `git rm` if the merge
should result in deletion of the path).
<new_branch>:: <new_branch>::
Name for the new branch. Name for the new branch.
@ -179,11 +180,11 @@ fatal: merge program failed
At this point, `git diff` shows the changes cleanly merged as in At this point, `git diff` shows the changes cleanly merged as in
the previous example, as well as the changes in the conflicted the previous example, as well as the changes in the conflicted
files. Edit and resolve the conflict and mark it resolved with files. Edit and resolve the conflict and mark it resolved with
`git update-index` as usual: `git add` as usual:
+ +
------------ ------------
$ edit frotz $ edit frotz
$ git update-index frotz $ git add frotz
------------ ------------

View File

@ -136,7 +136,7 @@ After seeing a conflict, you can do two things:
* Resolve the conflicts. `git-diff` would report only the * Resolve the conflicts. `git-diff` would report only the
conflicting paths because of the above 2. and 3.. Edit the conflicting paths because of the above 2. and 3.. Edit the
working tree files into a desirable shape, `git-update-index` working tree files into a desirable shape, `git-add` or `git-rm`
them, to make the index file contain what the merge result them, to make the index file contain what the merge result
should be, and run `git-commit` to commit the result. should be, and run `git-commit` to commit the result.

View File

@ -13,11 +13,20 @@ SYNOPSIS
DESCRIPTION DESCRIPTION
----------- -----------
git-rebase replaces <branch> with a new branch of the same name. When If <branch> is specified, git-rebase will perform an automatic
the --onto option is provided the new branch starts out with a HEAD equal `git checkout <branch>` before doing anything else. Otherwise
to <newbase>, otherwise it is equal to <upstream>. It then attempts to it remains on the current branch.
create a new commit for each commit from the original <branch> that does
not exist in the <upstream> branch. All changes made by commits in the current branch but that are not
in <upstream> are saved to a temporary area. This is the same set
of commits that would be shown by `git log <upstream>..HEAD`.
The current branch is reset to <upstream>, or <newbase> if the
--onto option was supplied. This has the exact same effect as
`git reset --hard <upstream>` (or <newbase>).
The commits that were previously saved into the temporary area are
then reapplied to the current branch, one by one, in order.
It is possible that a merge failure will prevent this process from being It is possible that a merge failure will prevent this process from being
completely automatic. You will have to resolve any such merge failure completely automatic. You will have to resolve any such merge failure
@ -26,9 +35,6 @@ that caused the merge failure with `git rebase --skip`. To restore the
original <branch> and remove the .dotest working files, use the command original <branch> and remove the .dotest working files, use the command
`git rebase --abort` instead. `git rebase --abort` instead.
Note that if <branch> is not specified on the command line, the currently
checked out branch is used.
Assume the following history exists and the current branch is "topic": Assume the following history exists and the current branch is "topic":
------------ ------------
@ -142,7 +148,7 @@ file you edit, you need to tell git that the conflict has been resolved,
typically this would be done with typically this would be done with
git update-index <filename> git add <filename>
After resolving the conflict manually and updating the index with the After resolving the conflict manually and updating the index with the

View File

@ -163,8 +163,7 @@ If this three-way merge resolves cleanly, the result is written
out to your working tree file, so you would not have to manually out to your working tree file, so you would not have to manually
resolve it. Note that `git-rerere` leaves the index file alone, resolve it. Note that `git-rerere` leaves the index file alone,
so you still need to do the final sanity checks with `git diff` so you still need to do the final sanity checks with `git diff`
(or `git diff -c`) and `git update-index` when you are (or `git diff -c`) and `git add` when you are satisfied.
satisfied.
As a convenience measure, `git-merge` automatically invokes As a convenience measure, `git-merge` automatically invokes
`git-rerere` when it exits with a failed automerge, which `git-rerere` when it exits with a failed automerge, which

View File

@ -94,11 +94,11 @@ current HEAD.
<2> Rewind the master branch to get rid of those three commits. <2> Rewind the master branch to get rid of those three commits.
<3> Switch to "topic/wip" branch and keep working. <3> Switch to "topic/wip" branch and keep working.
Undo update-index:: Undo add::
+ +
------------ ------------
$ edit <1> $ edit <1>
$ git-update-index frotz.c filfre.c $ git add frotz.c filfre.c
$ mailx <2> $ mailx <2>
$ git reset <3> $ git reset <3>
$ git pull git://info.example.com/ nitfol <4> $ git pull git://info.example.com/ nitfol <4>

View File

@ -16,7 +16,7 @@ DESCRIPTION
Examines paths in the working tree that has changes unrecorded Examines paths in the working tree that has changes unrecorded
to the index file, and changes between the index file and the to the index file, and changes between the index file and the
current HEAD commit. The former paths are what you _could_ current HEAD commit. The former paths are what you _could_
commit by running 'git-update-index' before running 'git commit by running 'git add' (or 'git rm' if you are deleting) before running 'git
commit', and the latter paths are what you _would_ commit by commit', and the latter paths are what you _would_ commit by
running 'git commit'. running 'git commit'.

View File

@ -15,7 +15,7 @@ DESCRIPTION
Examines paths in the working tree that has changes unrecorded Examines paths in the working tree that has changes unrecorded
to the index file, and changes between the index file and the to the index file, and changes between the index file and the
current HEAD commit. The former paths are what you _could_ current HEAD commit. The former paths are what you _could_
commit by running 'git-update-index' before running 'git commit by running 'git add' before running 'git
commit', and the latter paths are what you _would_ commit by commit', and the latter paths are what you _would_ commit by
running 'git commit'. running 'git commit'.

View File

@ -227,7 +227,7 @@ $ git diff
@@ -1 +1,2 @@ @@ -1 +1,2 @@
hello world! hello world!
+hello world, again +hello world, again
$ git update-index file.txt $ git add file.txt
$ git diff $ git diff
------------------------------------------------ ------------------------------------------------
@ -260,7 +260,7 @@ hello world!
hello world, again hello world, again
------------------------------------------------ ------------------------------------------------
So what our "git update-index" did was store a new blob and then put So what our "git add" did was store a new blob and then put
a reference to it in the index file. If we modify the file again, a reference to it in the index file. If we modify the file again,
we'll see that the new modifications are reflected in the "git-diff" we'll see that the new modifications are reflected in the "git-diff"
output: output:

View File

@ -1988,7 +1988,7 @@ static int check_patch(struct patch *patch, struct patch *prev_patch)
return error("%s: %s", old_name, strerror(errno)); return error("%s: %s", old_name, strerror(errno));
if (!cached) if (!cached)
st_mode = ntohl(create_ce_mode(st.st_mode)); st_mode = ntohl(ce_mode_from_stat(ce, st.st_mode));
if (patch->is_new < 0) if (patch->is_new < 0)
patch->is_new = 0; patch->is_new = 0;

View File

@ -2203,6 +2203,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
if (!strcmp(argv[j], "--")) if (!strcmp(argv[j], "--"))
seen_dashdash = j; seen_dashdash = j;
if (seen_dashdash) { if (seen_dashdash) {
/* (2) */
if (seen_dashdash + 1 != argc - 1) if (seen_dashdash + 1 != argc - 1)
usage(blame_usage); usage(blame_usage);
path = add_prefix(prefix, argv[seen_dashdash + 1]); path = add_prefix(prefix, argv[seen_dashdash + 1]);
@ -2211,6 +2212,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
} }
else { else {
/* (3) */ /* (3) */
if (argc <= i)
usage(blame_usage);
path = add_prefix(prefix, argv[i]); path = add_prefix(prefix, argv[i]);
if (i + 1 == argc - 1) { if (i + 1 == argc - 1) {
final_commit_name = argv[i + 1]; final_commit_name = argv[i + 1];

View File

@ -109,16 +109,17 @@ static int add_file_to_cache(const char *path)
ce->ce_flags = htons(namelen); ce->ce_flags = htons(namelen);
fill_stat_cache_info(ce, &st); fill_stat_cache_info(ce, &st);
ce->ce_mode = create_ce_mode(st.st_mode); if (trust_executable_bit)
if (!trust_executable_bit) { ce->ce_mode = create_ce_mode(st.st_mode);
else {
/* If there is an existing entry, pick the mode bits /* If there is an existing entry, pick the mode bits
* from it, otherwise assume unexecutable. * from it, otherwise assume unexecutable.
*/ */
struct cache_entry *ent;
int pos = cache_name_pos(path, namelen); int pos = cache_name_pos(path, namelen);
if (0 <= pos)
ce->ce_mode = active_cache[pos]->ce_mode; ent = (0 <= pos) ? active_cache[pos] : NULL;
else if (S_ISREG(st.st_mode)) ce->ce_mode = ce_mode_from_stat(ent, st.st_mode);
ce->ce_mode = create_ce_mode(S_IFREG | 0666);
} }
if (index_path(ce->sha1, path, &st, !info_only)) if (index_path(ce->sha1, path, &st, !info_only))

10
cache.h
View File

@ -106,6 +106,16 @@ static inline unsigned int create_ce_mode(unsigned int mode)
return htonl(S_IFLNK); return htonl(S_IFLNK);
return htonl(S_IFREG | ce_permissions(mode)); return htonl(S_IFREG | ce_permissions(mode));
} }
static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode)
{
extern int trust_executable_bit;
if (!trust_executable_bit && S_ISREG(mode)) {
if (ce && S_ISREG(ntohl(ce->ce_mode)))
return ce->ce_mode;
return create_ce_mode(0666);
}
return create_ce_mode(mode);
}
#define canon_mode(mode) \ #define canon_mode(mode) \
(S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \ (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
S_ISLNK(mode) ? S_IFLNK : S_IFDIR) S_ISLNK(mode) ? S_IFLNK : S_IFDIR)

View File

@ -170,9 +170,7 @@ static int get_stat_data(struct cache_entry *ce,
} }
changed = ce_match_stat(ce, &st, 0); changed = ce_match_stat(ce, &st, 0);
if (changed) { if (changed) {
mode = create_ce_mode(st.st_mode); mode = ce_mode_from_stat(ce, st.st_mode);
if (!trust_executable_bit && S_ISREG(st.st_mode))
mode = ce->ce_mode;
sha1 = no_sha1; sha1 = no_sha1;
} }
} }

View File

@ -344,16 +344,17 @@ int add_file_to_index(const char *path, int verbose)
ce->ce_flags = htons(namelen); ce->ce_flags = htons(namelen);
fill_stat_cache_info(ce, &st); fill_stat_cache_info(ce, &st);
ce->ce_mode = create_ce_mode(st.st_mode); if (trust_executable_bit)
if (!trust_executable_bit) { ce->ce_mode = create_ce_mode(st.st_mode);
else {
/* If there is an existing entry, pick the mode bits /* If there is an existing entry, pick the mode bits
* from it, otherwise assume unexecutable. * from it, otherwise assume unexecutable.
*/ */
struct cache_entry *ent;
int pos = cache_name_pos(path, namelen); int pos = cache_name_pos(path, namelen);
if (pos >= 0)
ce->ce_mode = active_cache[pos]->ce_mode; ent = (0 <= pos) ? active_cache[pos] : NULL;
else if (S_ISREG(st.st_mode)) ce->ce_mode = ce_mode_from_stat(ent, st.st_mode);
ce->ce_mode = create_ce_mode(S_IFREG | 0666);
} }
if (index_path(ce->sha1, path, &st, 1)) if (index_path(ce->sha1, path, &st, 1))

View File

@ -30,6 +30,16 @@ test_expect_success \
*) echo fail; git-ls-files --stage xfoo1; (exit 1);; *) echo fail; git-ls-files --stage xfoo1; (exit 1);;
esac' esac'
test_expect_success 'git-add: filemode=0 should not get confused by symlink' '
rm -f xfoo1 &&
ln -s foo xfoo1 &&
git-add xfoo1 &&
case "`git-ls-files --stage xfoo1`" in
120000" "*xfoo1) echo ok;;
*) echo fail; git-ls-files --stage xfoo1; (exit 1);;
esac
'
test_expect_success \ test_expect_success \
'git-update-index --add: Test that executable bit is not used...' \ 'git-update-index --add: Test that executable bit is not used...' \
'git config core.filemode 0 && 'git config core.filemode 0 &&
@ -41,6 +51,16 @@ test_expect_success \
*) echo fail; git-ls-files --stage xfoo2; (exit 1);; *) echo fail; git-ls-files --stage xfoo2; (exit 1);;
esac' esac'
test_expect_success 'git-add: filemode=0 should not get confused by symlink' '
rm -f xfoo2 &&
ln -s foo xfoo2 &&
git update-index --add xfoo2 &&
case "`git-ls-files --stage xfoo2`" in
120000" "*xfoo2) echo ok;;
*) echo fail; git-ls-files --stage xfoo2; (exit 1);;
esac
'
test_expect_success \ test_expect_success \
'git-update-index --add: Test that executable bit is not used...' \ 'git-update-index --add: Test that executable bit is not used...' \
'git config core.filemode 0 && 'git config core.filemode 0 &&