Skip to content

Commit bc8f0a9

Browse files
committed
Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 1648964 + 66b767b commit bc8f0a9

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

+1563
-435
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
@@ -382,6 +382,36 @@ sign `$` upon checkout. Any byte sequence that begins with
382382
with `$Id$` upon check-in.
383383

384384

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

Makefile

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

731731
TEST_BUILTINS_OBJS += test-chmtime.o
732+
TEST_BUILTINS_OBJS += test-cmp.o
732733
TEST_BUILTINS_OBJS += test-config.o
733734
TEST_BUILTINS_OBJS += test-ctype.o
734735
TEST_BUILTINS_OBJS += test-date.o
@@ -744,6 +745,7 @@ TEST_BUILTINS_OBJS += test-genzeros.o
744745
TEST_BUILTINS_OBJS += test-hash.o
745746
TEST_BUILTINS_OBJS += test-hashmap.o
746747
TEST_BUILTINS_OBJS += test-hash-speed.o
748+
TEST_BUILTINS_OBJS += test-iconv.o
747749
TEST_BUILTINS_OBJS += test-index-version.o
748750
TEST_BUILTINS_OBJS += test-json-writer.o
749751
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
@@ -4356,7 +4356,7 @@ static int try_create_file(struct apply_state *state, const char *path,
43564356
/* Although buf:size is counted string, it also is NUL
43574357
* terminated.
43584358
*/
4359-
return !!symlink(buf, path);
4359+
return !!create_symlink(state && state->repo ? state->repo->index : NULL, buf, path);
43604360

43614361
fd = open(path, O_CREAT | O_EXCL | O_WRONLY, (mode & 0100) ? 0777 : 0666);
43624362
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
@@ -505,7 +505,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
505505
}
506506
add_path(&wtdir, wtdir_len, dst_path);
507507
if (symlinks) {
508-
if (symlink(wtdir.buf, rdir.buf)) {
508+
if (create_symlink(lstate.istate, wtdir.buf, rdir.buf)) {
509509
ret = error_errno("could not symlink '%s' to '%s'", wtdir.buf, rdir.buf);
510510
goto finish;
511511
}

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);
@@ -278,7 +278,7 @@ static int create_default_files(const char *template_path,
278278
path = git_path_buf(&buf, "tXXXXXX");
279279
if (!close(xmkstemp(path)) &&
280280
!unlink(path) &&
281-
!symlink("testing", path) &&
281+
!create_symlink(NULL, "testing", path) &&
282282
!lstat(path, &st1) &&
283283
S_ISLNK(st1.st_mode))
284284
unlink(path); /* good */

0 commit comments

Comments
 (0)