commit - 9fc9df27559545b0cacca46fc6d8db711fdcaf41
commit + b88936d3f94e26ab32d9ef5d893b39fe633c6485
blob - ee5ecec15b1c9954ab672ace7b9165717723b7d2
blob + 8122fe9273cc37091dc13c83016ef03a2a436be5
--- got/got.1
+++ got/got.1
.Cm got status
ignore pattern will not be added.
.Pp
+If a
+.Ar path
+mentioned in the command line is not an unversioned file then
+.Cm got add
+may raise an error.
+To avoid unnecessary errors from paths picked up by file globbing patterns
+in the shell, paths in the argument list will be silently ignored if they
+are not reported by
+.Cm got status
+at all, or if they are reported with one of the following status codes
+and do not have changes staged via
+.Cm got stage :
+.Bl -column YXZ description
+.It M Ta modified file
+.It A Ta file scheduled for addition in next commit
+.It C Ta modified or added file which contains merge conflicts
+.It m Ta modified file modes (executable bit only)
+.El
+.Pp
The options for
.Cm got add
are as follows:
blob - 95e2e6bfa46ac12fd077b083c122ade77e54106f
blob + 158ecdaac43d28f8eb32bc6f3acf1cfda482fcaf
--- lib/worktree.c
+++ lib/worktree.c
struct got_repository *repo;
};
+static int
+add_noop_status(unsigned char status)
+{
+ return (status == GOT_STATUS_ADD ||
+ status == GOT_STATUS_MODIFY ||
+ status == GOT_STATUS_CONFLICT ||
+ status == GOT_STATUS_MODE_CHANGE ||
+ status == GOT_STATUS_NO_CHANGE);
+}
+
static const struct got_error *
schedule_addition(void *arg, unsigned char status, unsigned char staged_status,
const char *relpath, struct got_object_id *blob_id,
if (err)
goto done;
/* Re-adding an existing entry is a no-op. */
- if (status == GOT_STATUS_ADD)
+ if (staged_status == GOT_STATUS_NO_CHANGE &&
+ add_noop_status(status))
goto done;
err = got_error_path(relpath, GOT_ERR_FILE_STATUS);
if (err)
free(ondisk_path);
if (err)
return err;
- if (status == GOT_STATUS_ADD)
+ if (staged_status == GOT_STATUS_NO_CHANGE && add_noop_status(status))
return NULL;
return (*a->progress_cb)(a->progress_arg, GOT_STATUS_ADD, relpath);
}
blob - eabde9c24df6b9d72582040315ce0f913a98716c
blob + 230e87510d8cfc3bfd45d3bbfc058b91d0a05e6e
--- regress/cmdline/add.sh
+++ regress/cmdline/add.sh
return 1
fi
+ echo "changed file" > $testroot/wt/alpha
echo "new file" > $testroot/wt/bax
(cd $testroot/wt && got add -R * > $testroot/stdout)
ret=$?