git-central icon indicating copy to clipboard operation
git-central copied to clipboard

Fragile coding practices

Open AnrDaemon opened this issue 1 month ago • 0 comments

The code like

	grep $short_refname "$GIT_DIR/locked"
	if [ $? -eq 0 ] ; then

is fragile - it is prone to break on future refactoring. Also, it contains TWO other issues.

Much cleaner is to directly write what you intend the code to do:

	if grep -F "$short_refname" "$GIT_DIR/locked"; then

AnrDaemon avatar Dec 02 '25 09:12 AnrDaemon