mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-12-23 12:32:24 +02:00
sch2fig/git-file.c: keep the repo root search simple
I originally planned to attach the (deleted) tail after splitting the path of existing things into path_to_repo and path_in_repo, but it's easier if we just do the search on the combined path. This means that stat() will fail while we're in the deleted part of the path.
This commit is contained in:
parent
f4745953b5
commit
590724e3bb
@ -210,27 +210,20 @@ static char *canonical_path_into_repo(const char *repo_dir, const char *path)
|
||||
if (verbose > 1)
|
||||
fprintf(stderr, "full object path \"%s\"\n", tmp);
|
||||
|
||||
/* find which part of out path is inside the repo */
|
||||
/* find which part of our path is inside the repo */
|
||||
|
||||
end = tail = strchr(tmp, 0);
|
||||
while (1) {
|
||||
if (verbose > 2)
|
||||
fprintf(stderr, "trying \"%s\" tail \"%s\"\n",
|
||||
tmp, tail);
|
||||
/*
|
||||
* This should never fail, unless someone has been changing
|
||||
* things while we were searching.
|
||||
*/
|
||||
if (stat(tmp, &path_st) < 0) {
|
||||
perror(tmp);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (path_st.st_dev == repo_st.st_dev &&
|
||||
if (stat(tmp, &path_st) == 0 &&
|
||||
path_st.st_dev == repo_st.st_dev &&
|
||||
path_st.st_ino == repo_st.st_ino)
|
||||
break;
|
||||
|
||||
/* another "this cannot happen" problem */
|
||||
/* "this cannot happen" */
|
||||
if (tail == tmp) {
|
||||
fprintf(stderr,
|
||||
"divergent paths:\nrepo \"%s\"\nobject \"%s\"\n",
|
||||
|
Loading…
Reference in New Issue
Block a user