Skip to content

Commit a2eca68

Browse files
committed
futils: fix order of declared parameters for git_futils_fake_symlink
While the function `git_futils_fake_symlink` is declared with arguments `new, old`, the implementation uses the reverse order `old, new`. Let's fix the ordering issues to be `new, old` for both, which matches what symlink(3P) has. While at it, we also rename these parameters: `old` and `new` doesn't really make a lot of sense in the context of symlinks, which is why this commit renames them to be called `target` and `path`.
1 parent 51a2bc4 commit a2eca68

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/futils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,12 +834,12 @@ int git_futils_rmdir_r(
834834
return error;
835835
}
836836

837-
int git_futils_fake_symlink(const char *old, const char *new)
837+
int git_futils_fake_symlink(const char *target, const char *path)
838838
{
839839
int retcode = GIT_ERROR;
840-
int fd = git_futils_creat_withpath(new, 0755, 0644);
840+
int fd = git_futils_creat_withpath(path, 0755, 0644);
841841
if (fd >= 0) {
842-
retcode = p_write(fd, old, strlen(old));
842+
retcode = p_write(fd, target, strlen(target));
843843
p_close(fd);
844844
}
845845
return retcode;

src/futils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,11 @@ extern void git_futils_mmap_free(git_map *map);
316316
/**
317317
* Create a "fake" symlink (text file containing the target path).
318318
*
319-
* @param new symlink file to be created
320-
* @param old original symlink target
319+
* @param target original symlink target
320+
* @param path symlink file to be created
321321
* @return 0 on success, -1 on error
322322
*/
323-
extern int git_futils_fake_symlink(const char *new, const char *old);
323+
extern int git_futils_fake_symlink(const char *target, const char *path);
324324

325325
/**
326326
* A file stamp represents a snapshot of information about a file that can

0 commit comments

Comments
 (0)