Skip to content

Commit 9b0a20c

Browse files
committed
Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 9f58d12 + ae8ba4e commit 9b0a20c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1561
-434
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.perl eol=lf diff=perl
55
*.pl eof=lf diff=perl
66
*.pm eol=lf diff=perl
7+
*.png binary
78
*.py eol=lf diff=python
89
*.bat eol=crlf
910
/Documentation/**/*.txt eol=lf

Documentation/gitattributes.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,36 @@ sign `$` upon checkout. Any byte sequence that begins with
383383
with `$Id$` upon check-in.
384384

385385

386+
`symlink`
387+
^^^^^^^^^
388+
389+
On Windows, symbolic links have a type: a "file symlink" must point at
390+
a file, and a "directory symlink" must point at a directory. If the
391+
type of symlink does not match its target, it doesn't work.
392+
393+
Git does not record the type of symlink in the index or in a tree. On
394+
checkout it'll guess the type, which only works if the target exists
395+
at the time the symlink is created. This may often not be the case,
396+
for example when the link points at a directory inside a submodule.
397+
398+
The `symlink` attribute allows you to explicitly set the type of symlink
399+
to `file` or `dir`, so Git doesn't have to guess. If you have a set of
400+
symlinks that point at other files, you can do:
401+
402+
------------------------
403+
*.gif symlink=file
404+
------------------------
405+
406+
To tell Git that a symlink points at a directory, use:
407+
408+
------------------------
409+
tools_folder symlink=dir
410+
------------------------
411+
412+
The `symlink` attribute is ignored on platforms other than Windows,
413+
since they don't distinguish between different types of symlinks.
414+
415+
386416
`filter`
387417
^^^^^^^^
388418

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ X =
706706
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
707707

708708
TEST_BUILTINS_OBJS += test-chmtime.o
709+
TEST_BUILTINS_OBJS += test-cmp.o
709710
TEST_BUILTINS_OBJS += test-config.o
710711
TEST_BUILTINS_OBJS += test-ctype.o
711712
TEST_BUILTINS_OBJS += test-date.o
@@ -721,6 +722,7 @@ TEST_BUILTINS_OBJS += test-genzeros.o
721722
TEST_BUILTINS_OBJS += test-hash.o
722723
TEST_BUILTINS_OBJS += test-hashmap.o
723724
TEST_BUILTINS_OBJS += test-hash-speed.o
725+
TEST_BUILTINS_OBJS += test-iconv.o
724726
TEST_BUILTINS_OBJS += test-index-version.o
725727
TEST_BUILTINS_OBJS += test-json-writer.o
726728
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o

apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4360,7 +4360,7 @@ static int try_create_file(struct apply_state *state, const char *path,
43604360
/* Although buf:size is counted string, it also is NUL
43614361
* terminated.
43624362
*/
4363-
return !!symlink(buf, path);
4363+
return !!create_symlink(state && state->repo ? state->repo->index : NULL, buf, path);
43644364

43654365
fd = open(path, O_CREAT | O_EXCL | O_WRONLY, (mode & 0100) ? 0777 : 0666);
43664366
if (fd < 0)

builtin/clean.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
579579
clean_get_color(CLEAN_COLOR_RESET));
580580
}
581581

582+
fflush(stdout);
582583
if (strbuf_getline_lf(&choice, stdin) != EOF) {
583584
strbuf_trim(&choice);
584585
} else {
@@ -661,6 +662,7 @@ static int filter_by_patterns_cmd(void)
661662
clean_print_color(CLEAN_COLOR_PROMPT);
662663
printf(_("Input ignore patterns>> "));
663664
clean_print_color(CLEAN_COLOR_RESET);
665+
fflush(stdout);
664666
if (strbuf_getline_lf(&confirm, stdin) != EOF)
665667
strbuf_trim(&confirm);
666668
else
@@ -759,6 +761,7 @@ static int ask_each_cmd(void)
759761
qname = quote_path_relative(item->string, NULL, &buf);
760762
/* TRANSLATORS: Make sure to keep [y/N] as is */
761763
printf(_("Remove %s [y/N]? "), qname);
764+
fflush(stdout);
762765
if (strbuf_getline_lf(&confirm, stdin) != EOF) {
763766
strbuf_trim(&confirm);
764767
} else {

builtin/difftool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
497497
}
498498
add_path(&wtdir, wtdir_len, dst_path);
499499
if (symlinks) {
500-
if (symlink(wtdir.buf, rdir.buf)) {
500+
if (create_symlink(lstate.istate, wtdir.buf, rdir.buf)) {
501501
ret = error_errno("could not symlink '%s' to '%s'", wtdir.buf, rdir.buf);
502502
goto finish;
503503
}

builtin/init-db.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
7676
if (strbuf_readlink(&lnk, template_path->buf,
7777
st_template.st_size) < 0)
7878
die_errno(_("cannot readlink '%s'"), template_path->buf);
79-
if (symlink(lnk.buf, path->buf))
79+
if (create_symlink(NULL, lnk.buf, path->buf))
8080
die_errno(_("cannot symlink '%s' '%s'"),
8181
lnk.buf, path->buf);
8282
strbuf_release(&lnk);
@@ -280,7 +280,7 @@ static int create_default_files(const char *template_path,
280280
path = git_path_buf(&buf, "tXXXXXX");
281281
if (!close(xmkstemp(path)) &&
282282
!unlink(path) &&
283-
!symlink("testing", path) &&
283+
!create_symlink(NULL, "testing", path) &&
284284
!lstat(path, &st1) &&
285285
S_ISLNK(st1.st_mode))
286286
unlink(path); /* good */

0 commit comments

Comments
 (0)