From patchwork Sun Jan 28 22:34:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534668 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 820B84597C for ; Sun, 28 Jan 2024 22:34:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481299; cv=none; b=q7O6fjDueUx5X89vWa+12phe5lpjEZM2TaLVJ6fRindJu5/U+VN29GkOGLC8Qa1Nrdg1/1mArhQmL7r8T3Gx4sEDkRTW9SyXyed0bZH/hvGXrHvcmLfNi+W13Jr+nl1wS/YixE1IbiHIys+FrMybcxhMpQYK3OnVQUwejbdkPM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481299; c=relaxed/simple; bh=V37AEyqlltY9lepgl1mE/4JkhjbsfK/djZb+FLWCShw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jMv+vjUJV1R/JR3SbN5GdjeZGUeSV2QAf5ebhor68gaxKLpicEl05w8s2HoKlXGJZ//3oJOI/2lz3ztGGl+IfELi6IMeKKU33qUe+YUdIf+xhIlWHxEVbZaC+tyZuGgIr/HUF1Dun3p3YifhR7uu8+IuP7GH+qdPIN31hNZsgqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FsNRyF2m; arc=none smtp.client-ip=209.85.160.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FsNRyF2m" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-42a8af3c10cso16944521cf.0 for ; Sun, 28 Jan 2024 14:34:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481297; x=1707086097; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U8A1lp9jpxGG9/mMJ/5+qub/9diavCbzMP2XThYtQ6I=; b=FsNRyF2mt5KA2A6YOioqjdNKP4+BQTBTy1FZaCI2CSalR6OSAcxcUjZVlgZ/WNK++t hh8xTNgab0yhfefX0o7w5DBH3g68VGoEWoydtjXLnvxpv5D4z3UjpCrXxUWvXdLwm8fH /9t5OCXjbSL/PRCapEBUM66Yqp9qHEozquPeFyel96YywRmeLMKtQUltWUA5IAGa2OzL mE/iIolHX1S5560AfzpGcc/uqNRbLPgbGWhPbThJWLY+SgUmjlF8G1aDwU/NmZgyViFV cbdM97u87JwfG8pBl7Kyku0kdWfCFTJScTh1+uIKIidKvON0hnjfyaA1M+BpRuSzrD+a dP1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481297; x=1707086097; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U8A1lp9jpxGG9/mMJ/5+qub/9diavCbzMP2XThYtQ6I=; b=ibeLbImjOcvGWibvhXp311n0r4Y/CGu6l9Q7HFLcecQcHLZlm3/Kr7O7CgVORmz7O6 TlA9xij/oTln365whKZvODVkNEL/cPVAHewIEFfVgbcC6XM024UEtjo/0Eh7oUI6w8j+ HxKFVFLKzr1jepknDKwFG79CK7RPsjFGB2fLJITH3jd5kp2eyhKnmUtmc9oWqX73iaZq ss71WAGIZm+H09h5csmW7sZHwkh1VdKDSXtRzSDvofr2cTCZA5QS169FwmRy9vUn3rR/ bkXSZIZOq4JUdwWHvq7uraB3Sgnodk/A2IQdBleV3pyzg+flvBnblaCSRibA2xhJEe+i MzRg== X-Gm-Message-State: AOJu0YxuRw/6/oPwpdoIC2Pw6Uczu9iMmP5TISJlrtPUxw/Sz6Eu6Psn 8ykR71VSJjKXpIumtATsAKOjRYg1yX/G1LKSGZ2GtIS/jJmlCRG4 X-Google-Smtp-Source: AGHT+IHIOgdVib+qECHdUOjs16vQq6qR2Z+UXWfk2xjudnQkJ1qWxjj3JZs7s2M1Dl2GAMQrUOyJLQ== X-Received: by 2002:ae9:e014:0:b0:783:bdab:aaa7 with SMTP id m20-20020ae9e014000000b00783bdabaaa7mr5011428qkk.115.1706481297372; Sun, 28 Jan 2024 14:34:57 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id j19-20020a17090a841300b00294483f38dbsm4408893pjn.9.2024.01.28.14.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:53 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 6680152019A; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 1/8] completion: bisect: complete bad, new, old, and help subcommands Date: Sun, 28 Jan 2024 13:34:40 -0900 Message-ID: <20240128223447.342493-2-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The bad, new, old and help subcommands to git-bisect(1) are not completed. Add the bad, new, old, and help subcommands to the appropriate lists such that the commands and their possible ref arguments are completed. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 185b47d802..06d0b156e7 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1449,7 +1449,7 @@ _git_bisect () { __git_has_doubledash && return - local subcommands="start bad good skip reset visualize replay log run" + local subcommands="start bad new good old skip reset visualize replay log run help" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __git_find_repo_path @@ -1462,7 +1462,7 @@ _git_bisect () fi case "$subcommand" in - bad|good|reset|skip|start) + bad|new|good|old|reset|skip|start) __git_complete_refs ;; *) From patchwork Sun Jan 28 22:34:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534664 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2821446C3 for ; Sun, 28 Jan 2024 22:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481295; cv=none; b=Cvv9Qr04AFg5a8JAkGy8btcN1LSn75ooLtiEX6YbGKMqlau8I8oXgknWd0Z6nk3OootOikVtDmsd4fR+yrcXgOqj2HxJgrDzlzDeD2X2AWBvqF8Mi31qX02duxbz8Tjwh0xtOdYgMHGbDuhRmSczzp3bddhAU6+/1seYheZgdhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481295; c=relaxed/simple; bh=AiVe7XYbFn176gBtgBBvJ8zVjrsqpNydpAm8IZoC27k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VzfnVb7q1c7LwCg6xIPfHNClVk5scDpp5PbalgFuLTOfbU6Z6Y3DX7RDBde9jybeyE8GDg0HOAVS3zEnYJrr1VzzHJRoQ+4CFQD5fTgBY/KEfue5gmD+rZxtrwVp7rrWNxOoQwwgdIEpOw23BoxjCk6oBjPqrEDoKPFmeuTokDc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qb6xfy95; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qb6xfy95" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-595aa5b1fe0so1493228eaf.2 for ; Sun, 28 Jan 2024 14:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481293; x=1707086093; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oNULBkTf8dpbUhhPjhIKAtXvrswxNBtLwua0PFRGYq0=; b=Qb6xfy950nEjN63bvdszVVzo0Dt5pfaroSupFOJ54nABX3bxivRH9DV0ezgOV9wVlf U6MbsIFxlFKbrs3H+B/SzKG/pt0FfsKX9lpn5heZmPzrdCnzg3m4NOWetpOhPlRRU+I5 tUuJ55tg3ePNx06TRrZPb4UbTNWG/JcSsSy2kLstgWCXv7KO/PfaysC09OofxNe4+slf WX0Hv+mb5FzkwvCwSj0uhIyJmss+Rjfv8rwXBA24CvhiOcl/x8OBf31vQBtP+8068miL Ix5Crz8hZltZjXg9X64+L1NnIERtf5GkrdBFRBqdjZNjwR4PiP+Px10mVIWzOgd+Mu9z suNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481293; x=1707086093; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oNULBkTf8dpbUhhPjhIKAtXvrswxNBtLwua0PFRGYq0=; b=mXYSmUniVpZVvOHwizgTYUPtF3DfQk0vou0fYdSJ4VWkQT2pF2cZZb3/j5cP4pRuza /t2ecsQW1W3xUkloiD2SsV5PV8ILBPLzCj6PfjZauRwgHFWmScYGdsReF78sQGhrPzZp He4VMpRHXF0Yrd84cjtFNprhXHn/ndfss8wDkB11lXM6dmrfxOurCxP72wW/EoWhSBm/ 80bqZSYQh3vXAVMr8zUq+FdD5/P+aX3BehhfMI9eyCQ4QNtF1+m4gBANnNFIF3ySrONS iaEBp4iSZqfT6K85l6ecxcKRFLvW3nWoDqJN0eTmTGQbH83fqC+MYrEbGk3Z/P3i7sHZ eAKw== X-Gm-Message-State: AOJu0Yy6igABJfELAk1vjuR2s6zBStqvWljtq73qdIGxhw4ki0M+vl5F ugnDJD03afxeRR81P/pt8Nh1Bs2GCloG38ZP8gEMwmSm1DXUMFdY X-Google-Smtp-Source: AGHT+IHtfv21T0Z6N+zKzw08DTgU8hkWitGEYq/bByFwqhKhr+q1NL4kIMNspDhaUHx+ffl8X9X4Og== X-Received: by 2002:a05:6359:459c:b0:176:d0a8:8df with SMTP id no28-20020a056359459c00b00176d0a808dfmr6131819rwb.8.1706481292788; Sun, 28 Jan 2024 14:34:52 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id nm13-20020a17090b19cd00b0029061498a18sm6896825pjb.24.2024.01.28.14.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:52 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 6A5F052027C; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 2/8] completion: bisect: complete custom terms and related options Date: Sun, 28 Jan 2024 13:34:41 -0900 Message-ID: <20240128223447.342493-3-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 git bisect supports the use of custom terms via the --term-(new|bad) and --term-(old|good) options, but the completion code doesn't know about these options or the new subcommands they define. Add support for these options and the custom subcommands by checking for them if a bisection is in progress and adding them to the list of subcommands. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 06d0b156e7..8baf330824 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1449,7 +1449,20 @@ _git_bisect () { __git_has_doubledash && return - local subcommands="start bad new good old skip reset visualize replay log run help" + __git_find_repo_path + + # If a bisection is in progress get the terms being used. + local term_bad term_good + if [ -f "$__git_repo_path"/BISECT_START ]; then + term_bad=$(__git bisect terms --term-bad) + term_good=$(__git bisect terms --term-good) + fi + + # We will complete any custom terms, but still always complete the + # more usual bad/new/good/old because git bisect gives a good error + # message if these are given when not in use, and that's better than + # silent refusal to complete if the user is confused. + local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __git_find_repo_path @@ -1462,7 +1475,22 @@ _git_bisect () fi case "$subcommand" in - bad|new|good|old|reset|skip|start) + start) + case "$cur" in + --*) + __gitcomp "--term-new --term-bad --term-old --term-good" + return + ;; + *) + __git_complete_refs + ;; + esac + ;; + terms) + __gitcomp "--term-good --term-old --term-bad --term-new" + return + ;; + bad|new|"$term_bad"|good|old|"$term_good"|reset|skip) __git_complete_refs ;; *) From patchwork Sun Jan 28 22:34:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534666 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F2EC446C5 for ; Sun, 28 Jan 2024 22:34:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481295; cv=none; b=eqtXbklj1fmyezYyYZwlivmWZ56VPvDq1DtPE5tkvRj1cK/MncILFJ+bz/exrriLguhcHz2Ika2nDWaKAt1mcQCTZ5SzRxivf43amNt6GieEeQFUvVrNV9jd0Et7fhTDqP3CoUHKZVru6LZoAPx3S1YECUs2ZhWotb6zMwBlKX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481295; c=relaxed/simple; bh=Q+q/y6uZT6blpKYsM+HtyVb3QeEi1rr7swsSTExZ/Ns=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sk841qWStS95G/7EeVZ59ibZNhdVsAKBAjkSC01Od+xUQxRrs7XQSWhFbkR0pc7KanmaLSABAROwcYUQ9Eow2hvL9IMt4wbk+LguBQ5yUCRtmXYajfRcMrRNTGWVP5WpqWQB2vSEex3zEccmT6aMKjv6VTnB7D036A6i5XP90vM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ivlFMkEV; arc=none smtp.client-ip=209.85.167.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ivlFMkEV" Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3bd72353d9fso1902052b6e.3 for ; Sun, 28 Jan 2024 14:34:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481293; x=1707086093; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wqtZyW4IvS3bvGHhbR9BSu6WC1gV015enXjMxrNzJiA=; b=ivlFMkEVtZmQC8TzNX306zBiy+risC5Ms0nqa3lxnv/OYI2NrYl4a+n0ewH5Nyuww+ ws2TGNTG9OfFcnZozNuFQCp3ikDxQlGuECsu8TuY2CsquTi6bnjgkqdhYFqSA6F3wcDB euGxJoWwmy02HqC/Km0SQ7B/kb2KYbQoLfylhVy8aFMAO9XG7SJ5POob1o+ct3+c1s3x 1kWIxcFMZC/0107pk4ksMeQ/YUuI0IrxBtTdXaBSlCUHr84EUWXs7ky3AV7WApm3w4pO j0XNK5u7iT5iqacBpS37xvm6JMDWQFG4CZ8NVq8ycSvSSPqhPH0amAFEeYjM7TXXz/dh Q7ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481293; x=1707086093; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wqtZyW4IvS3bvGHhbR9BSu6WC1gV015enXjMxrNzJiA=; b=ZKIdSdMzNpmvv4vx6Pmr2I1pmF2fsSHNo0T6N/FLaO7fzEveTg9pf3r7pzi4GE3hv+ QgyPgLS3XJyQYd6VGGf/6myNcW62kIG29pRkFk5bZSzOv8tWeQEoKlyyyzPY3IRKN3sG gDmC/U/t4m1GENpT4c2bHXfCg+ptF4o3wdbvD5oWVDGUjaG8tfr2IUpF8gW89mV8zph+ BY4Ho7XLYEGRPK515tBNbCyq6GTmM4xq2zIYeR+RW8w3W0sTTKpNU2mZ89Pfnuoae9LE WQIZBnSUM7lUi8GIxhy9Np4x3JUOBy5k3vpZHdaY/P8TvPaNod/m0hT55+5bvqdKt9lP bcAQ== X-Gm-Message-State: AOJu0YzAPrLAnhRUzCtRX6FydYPwqoM7CQYVYSmdrO9z0rBJjbh3kaXX 3MK0wYN9naSRs8CH6BdKbJ+3Uda2dbR/TwjSHXTTqs3qVJl5/xsO+zlNW7P0 X-Google-Smtp-Source: AGHT+IHb+/ISfEdsGRI+Kvs42hNjzmZktLzDU+gErzfeLVbrWl06Ra74vKVkWnaISeEdTv5VRAF6BQ== X-Received: by 2002:a05:6808:2012:b0:3be:4cbc:ca14 with SMTP id q18-20020a056808201200b003be4cbcca14mr2432312oiw.19.1706481293440; Sun, 28 Jan 2024 14:34:53 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id u33-20020a056a0009a100b006ddc335ab6fsm4580279pfg.158.2024.01.28.14.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:52 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 6C71852027D; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 3/8] completion: bisect: complete missing --first-parent and --no-checkout options Date: Sun, 28 Jan 2024 13:34:42 -0900 Message-ID: <20240128223447.342493-4-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The --first-parent and --no-checkout options to the start subcommand of git-bisect(1) are not completed. Enable completion of the --first-parent and --no-checkout options to the start subcommand. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8baf330824..2ed600244a 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1478,7 +1478,7 @@ _git_bisect () start) case "$cur" in --*) - __gitcomp "--term-new --term-bad --term-old --term-good" + __gitcomp "--first-parent --no-checkout --term-new --term-bad --term-old --term-good" return ;; *) From patchwork Sun Jan 28 22:34:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534665 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6E1F446A3 for ; Sun, 28 Jan 2024 22:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481295; cv=none; b=WQANQCIV8l214kVWTPwQyTsgcwscwDeqQEjpujx19wqCWYULa82zgVNtM+thVh5slJJ5nQpksbmxomPZkCv1D6ETR6iDsiTbPL/I28GV91TQSJcIneRgkANSYAFayGs2eUXrHPXiefbMVJvEifxHzRb6uVMNmHgWSqVWpuiQH7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481295; c=relaxed/simple; bh=IEHfSRE4Jbp24UVMXHHlUG8xKOwgs/qdfLp53XN930o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kobQ2k90vVH5Hv5J/uSmrIJGG0UjfMq94dMSiKErItUcgXrJQ80dWnbphuhB62eWYZwakfCkmLMPqGnbXiIkJB0Eu9y6d+FF/vsgdmBa22xLYctbaoO/O8+jWPcewrcmIUfVWodTYifNBIZ0xIn5EasBFQN9/rmv1dDv7byXAE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MU4olZpE; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MU4olZpE" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d780a392fdso16875545ad.3 for ; Sun, 28 Jan 2024 14:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481293; x=1707086093; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=APniPNMLisqNBc4JkIPP6z4qfYZD3deOqVuZPMXusTg=; b=MU4olZpE7euGuTWtAmUdn2IgjBu+YiMjGJ9mFmKRXVrY7hfnQ+0JQ6AzqFNU90pKOH u3pRAZoBTvKQxogYsYbYmEOZyJhJ9qX0uWOB+kUaW0Plq/IONQG0NqKtHKVXJ64MNGLe 8HOzj0wPwzOQBxrB1SXozri1mAO1yy3qbAf8rlO29ZqLmiYQ88RxAlwN4Cty53oDqko7 B33aA7b6J9LPZM2tTXxmqdlQRW9BG4OdE8jntYUXQDp9F3oReupQHPpRmysxFH2M8IBr atXrDynyZPmdFx53AHS/VjIbqkPe0XSTM5aTzMTwqf+EIPXYUkjX1J3jlguPhiYs4a3v H9lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481293; x=1707086093; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=APniPNMLisqNBc4JkIPP6z4qfYZD3deOqVuZPMXusTg=; b=LwbFmdksUcGbfgzWjzzW7Ya8ygFWBIdyYiQIPye7qb5LCC+pi/nmUQO+IEx+6CpEgH OTANDQtlxwaWgvHp4c+PNxzbL/gmFzfKhbGhNzmEu/9BxH+hsa3oGhxW/CA3FHSc+14A kKRGjMafV4ioaIZMZYJytdo+fMl5LE8OsZR2Ote63GjvPNzlcRqVGir1tQGnBa9f+dRo NfoEVkVJCvZ24vRAbiqvUqJDRQ/Dd71XPF+qRtMO95hlNvZrM66BU659986/iJBHNjW0 ZlwWTlKb/z6j5wlxjb8vjowxbc7Mx2S+59JLZyGuofvZjky/hcXFwM05aeRat1eo27yC aQpA== X-Gm-Message-State: AOJu0YzbVe7pbdqnLxsgZbQcU2ZZich30OAltJq0GHubIt3D+6hjiu6b lcQZ6YoQ7khcs07+Q597Nx+s3zKNoPn5gVDibwa0uM+H97JxsiOVoNHNmbMm X-Google-Smtp-Source: AGHT+IFxtN3jJ+YvrFrT6miZNpJnFqTtLwVdoDYlMEUVCd3NNhCAiaC/bOLMrvyPHVHmaAANu56crQ== X-Received: by 2002:a17:903:1107:b0:1d5:4b18:17d1 with SMTP id n7-20020a170903110700b001d54b1817d1mr4473244plh.106.1706481293086; Sun, 28 Jan 2024 14:34:53 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id jy15-20020a17090342cf00b001d71eac34a6sm4077282plb.294.2024.01.28.14.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:52 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 6E2B2520292; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 4/8] completion: new function __git_complete_log_opts Date: Sun, 28 Jan 2024 13:34:43 -0900 Message-ID: <20240128223447.342493-5-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The options accepted by git-log are also accepted by at least one other command (git-bisect). Prepare to factor out the common option and option argument completion code by defining a new function. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 101 +++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 2ed600244a..dfd504c37e 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2089,6 +2089,107 @@ __git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-c __git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd" __git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:" +# Complete porcelain (i.e. not git-rev-list) options and at least some +# option arguments accepted by git-log. Note that this same set of options +# are also accepted by some other git commands besides git-log. +__git_complete_log_opts () +{ + COMPREPLY="" + + local merge="" + if [ -f "$__git_repo_path/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$prev,$cur" in + -L,:*:*) + return # fall back to Bash filename completion + ;; + -L,:*) + __git_complete_symbol --cur="${cur#:}" --sfx=":" + return + ;; + -G,*|-S,*) + __git_complete_symbol + return + ;; + esac + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --date=*) + __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" + return + ;; + --decorate=*) + __gitcomp "full short no" "" "${cur##--decorate=}" + return + ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; + --ws-error-highlight=*) + __gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}" + return + ;; + --no-walk=*) + __gitcomp "sorted unsorted" "" "${cur##--no-walk=}" + return + ;; + --diff-merges=*) + __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}" + return + ;; + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + $__git_log_gitk_options + $__git_log_show_options + --root --topo-order --date-order --reverse + --follow --full-diff + --abbrev-commit --no-abbrev-commit --abbrev= + --relative-date --date= + --pretty= --format= --oneline + --show-signature + --cherry-mark + --cherry-pick + --graph + --decorate --decorate= --no-decorate + --walk-reflogs + --no-walk --no-walk= --do-walk + --parents --children + --expand-tabs --expand-tabs= --no-expand-tabs + $merge + $__git_diff_common_options + " + return + ;; + -L:*:*) + return # fall back to Bash filename completion + ;; + -L:*) + __git_complete_symbol --cur="${cur#-L:}" --sfx=":" + return + ;; + -G*) + __git_complete_symbol --pfx="-G" --cur="${cur#-G}" + return + ;; + -S*) + __git_complete_symbol --pfx="-S" --cur="${cur#-S}" + return + ;; + esac +} + _git_log () { __git_has_doubledash && return From patchwork Sun Jan 28 22:34:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534669 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4448D45BE9 for ; Sun, 28 Jan 2024 22:35:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481301; cv=none; b=P4XlWJLXNDPDsjbkFtG+DA5pNX39w4B3PDeMl0pqThHIz3JC7/FotsKiXu2q7u/ME8BEccPusngn97ncyOXWSi/MfBv+QGmAmwwF+Q9KrAC6uZYtYkOT4G8G3+2L1uuv4OF25Ipg+veKVVpRsn5yXApUTad/D88faukDotSGH2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481301; c=relaxed/simple; bh=6DeqdR0FDSo4xrhOBEf5P3jC+c4poSkaHL0OdhoL/os=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HSoCwIg7M8R3wlFiDkVNOOwKkqY2F/dv48Ra6w5uwjd0rDk7uwf5NRevYzIlwhDkl6J8z/cawzo5JHrJma6Pr6N4CYceQggNSRot8s3JofTZaLchviz3mglwlH2v+5QNzSVzSSV+0xqqOkXwWHskGUvdtctkrhaH3qJ5/E+7eKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WCsvnk4F; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WCsvnk4F" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6ddcfbc5a5fso1971047b3a.2 for ; Sun, 28 Jan 2024 14:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481299; x=1707086099; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e+ifp6pK/q+XHI+srjS5uN1ERWLivbtwW/FOa11u8A8=; b=WCsvnk4FeKkqQABmBY17HFR+uVVtWH8FmNHrp8/DtYJ3uUmJbtvsvMTLATMxoecuxy wIJ8Ez/e8saxuE0E4WhTD+darEeTdJkkFwlJi+k+Y40DUUCJtO8YtTa33PD9bT7xWww3 N4+ObV5OtnDtBT2ExnR5djN60T9UXK9jb5xElXcZDUhE46DM8OvfJasUllZSerRbDCX5 ZJ+Q3yzj4I/J4r1u6m95bwAwoldLAwh28pEwnx44ihCLBLxisoUSV+Qb1JErnXBRWsLi fQzyqH0ao1NIn6xUgKlW6Mts3ACEEij6vok79rsz7csYNsys29uu784ZI+FfN/9JCJke DgVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481299; x=1707086099; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e+ifp6pK/q+XHI+srjS5uN1ERWLivbtwW/FOa11u8A8=; b=GM77sP7lfZ71heXjorFfuDewMzJBbm0CyYPy0dfghixl4SwpIhav8IDYsyPtQo+WQt 1sbvNzrhaHVxTvVjFDCs1hSlY9Mqz9gmG8FATKdk8ZHL2wLV+Pk+YynVjfy5IsOyrQeg CIrTqD+dnc+7GeoUtaqAN/B8+s9hIR34cWa6fB21hdaodXXhG7cRVR1mg6c1a3WUvBYO R10B/E0j20s0CbGmNVNbJlH/xcyKYDp8JQuuiFlku+qGDdjxtX1O4csya4U+Y6yje3Lf 4EIhGazTcanwmvwKFT8ExVWufhpiNASAzV9COKKNstuYVOWIRhFRAEN30WxcZgz3itG9 ME8w== X-Gm-Message-State: AOJu0YzdD3mPYH2Gg14oCE6RuT8Uawpzt07d+hPsrRbk8BOeisnfGq7A KBuM71K3ZXKUrUjxOMUwVZdCRQ7V9/8XdkOErp4IBTVTpG5xFZ0F X-Google-Smtp-Source: AGHT+IG7p9RFX6QVcZ0+Q/th/D+Nv5nfEhVoxj1/qaPzkusdmDtzWSncfbKCX3SrXeqFB/889/3EQw== X-Received: by 2002:a05:6a00:80c4:b0:6dd:a004:c193 with SMTP id ei4-20020a056a0080c400b006dda004c193mr3011930pfb.12.1706481299534; Sun, 28 Jan 2024 14:34:59 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id f15-20020aa79d8f000000b006dd872c00dasm4719212pfq.96.2024.01.28.14.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:57 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 6FD11520538; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 5/8] completion: log: use __git_complete_log_opts Date: Sun, 28 Jan 2024 13:34:44 -0900 Message-ID: <20240128223447.342493-6-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the new __git_complete_log_opts function to handle option and optiona rgument completion in _git_log. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 95 +------------------------- 1 file changed, 3 insertions(+), 92 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index dfd504c37e..41c76c1246 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2195,98 +2195,9 @@ _git_log () __git_has_doubledash && return __git_find_repo_path - local merge="" - if [ -f "$__git_repo_path/MERGE_HEAD" ]; then - merge="--merge" - fi - case "$prev,$cur" in - -L,:*:*) - return # fall back to Bash filename completion - ;; - -L,:*) - __git_complete_symbol --cur="${cur#:}" --sfx=":" - return - ;; - -G,*|-S,*) - __git_complete_symbol - return - ;; - esac - case "$cur" in - --pretty=*|--format=*) - __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) - " "" "${cur#*=}" - return - ;; - --date=*) - __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" - return - ;; - --decorate=*) - __gitcomp "full short no" "" "${cur##--decorate=}" - return - ;; - --diff-algorithm=*) - __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" - return - ;; - --submodule=*) - __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" - return - ;; - --ws-error-highlight=*) - __gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}" - return - ;; - --no-walk=*) - __gitcomp "sorted unsorted" "" "${cur##--no-walk=}" - return - ;; - --diff-merges=*) - __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}" - return - ;; - --*) - __gitcomp " - $__git_log_common_options - $__git_log_shortlog_options - $__git_log_gitk_options - $__git_log_show_options - --root --topo-order --date-order --reverse - --follow --full-diff - --abbrev-commit --no-abbrev-commit --abbrev= - --relative-date --date= - --pretty= --format= --oneline - --show-signature - --cherry-mark - --cherry-pick - --graph - --decorate --decorate= --no-decorate - --walk-reflogs - --no-walk --no-walk= --do-walk - --parents --children - --expand-tabs --expand-tabs= --no-expand-tabs - $merge - $__git_diff_common_options - " - return - ;; - -L:*:*) - return # fall back to Bash filename completion - ;; - -L:*) - __git_complete_symbol --cur="${cur#-L:}" --sfx=":" - return - ;; - -G*) - __git_complete_symbol --pfx="-G" --cur="${cur#-G}" - return - ;; - -S*) - __git_complete_symbol --pfx="-S" --cur="${cur#-S}" - return - ;; - esac + __git_complete_log_opts + [ -z "$COMPREPLY" ] || return + __git_complete_revlist } From patchwork Sun Jan 28 22:34:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534670 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 789644C626 for ; Sun, 28 Jan 2024 22:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481303; cv=none; b=idoouEXmYMEIsyiVS0U+OPYx74KApZv7pPkzPorF6kEWR2N4rgwJho4u8UtPH3kcxaRyExbhelcf757p3ZgBedkbqq+KopH34gZH72oxi7ljQt/N8vqGKMExOKaBto7y1H3DpD6jbYgiLI9eZmLFT4ZFFKOSK4U+MR2yDMhDT9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481303; c=relaxed/simple; bh=omGF1o/2+5WqiwdFjue7pS3a5SFrhbBLVndhmJ9g7MQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oJM1FIkJlx6gnhosZ5nmSkhLjAbObVlR4OAaHnM9gztsjmE65w/sI3XgvRx+6e19EVat6edBGQv+CG0EgMGwm0Ai4FzeAoZX6U4NoYMcjZ4MFDTVnn0+YV4CmFSJdIeDmyoHAKnviisyMK8tOkFdjFfYKVdNd/mmeQE4cqiywi8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JM7b0TwK; arc=none smtp.client-ip=209.85.167.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JM7b0TwK" Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3bba50cd318so2211225b6e.0 for ; Sun, 28 Jan 2024 14:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481301; x=1707086101; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CdelmLWlr+xRsniqLo4vYuuoJXVLc2gZ++2oLsRkxcQ=; b=JM7b0TwKdtlLrVv8/MHGb+8arRx/uwEx5geAFul3CBiN+9VldSLQF8oq7wWLBw7wNc Uz91nBKmEVvWTAD5p1mj1h+0Ix1tNtJ8VJdfGYiJhkh3hT7npOjH/vu5Df7Nmet91NWL LjFYjxaZbb5msbFgerjqts3xIzlXPs0ZL7fHY4m7sjSDNz0GjK8G0RLF8qtumglgFYeq 11Umb0NR9spsoAeAIxwBgzt0xYASBXGAWpkb0RAHnKhFuTRT3OSshoL4+EgAyPlhBy1h 7GAGey4Rw1iwBAruFisRmk2xmCSibOGZaKtxOOcgqn49caA+PHtE5SVRgGCOuQNUQycJ QLCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481301; x=1707086101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CdelmLWlr+xRsniqLo4vYuuoJXVLc2gZ++2oLsRkxcQ=; b=uwdm30AfCYMks1tfy+lqFdxbNKzK1M2V9pHYPqpGcMqbTm7xg6QplzqAQ4KidswRE2 kRtHyq4gY3cyhPuKXcIx8BEUr1TPQQIMv1UJpqRlLkhosAUDxt8Kb9HbL/M2dYdbJZKI 8b5gIQKMrvBPhOUa8XgDgPTs0yf/EE7eZDynxJcwRlb2Mwl823UM2TQH5TgBUIH6oA+5 v8zR2+QQsGCyOmd/fu/uS9ZD88+fWcOqyxqHJa8WN1qTu9E6/hPtEd7Jy/yA9v1l6v+m wd1PaRpMtTILgj0T2Jc/oVzeWQG6LchCoVX95QwPgCAF932Z1mUGAOb4x5HwXiBY0XUb QpkA== X-Gm-Message-State: AOJu0YxHsh4oR81tCoK3k/HVddFbviUuuPvrf7PTLwBHcnNTCJWqqv8E oGNTQ/ooW1xuyW2Vj49OewuHxJw2Ar9WIDTny4Ndj92F7DdiDMZR6Ry8YC1P X-Google-Smtp-Source: AGHT+IHWLb/+ZnkWj89+TbDQwffwed1SopdyRsJefs/Vfn2vakPrmoCZlHRBKxpUsD7GkrJkOJxEeA== X-Received: by 2002:a05:6808:e85:b0:3bd:59da:57ba with SMTP id k5-20020a0568080e8500b003bd59da57bamr5137561oil.59.1706481301516; Sun, 28 Jan 2024 14:35:01 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id s10-20020a17090aba0a00b00290b37765casm6712713pjr.26.2024.01.28.14.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:57 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 71742520539; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 6/8] completion: bisect: complete log opts for visualize subcommand Date: Sun, 28 Jan 2024 13:34:45 -0900 Message-ID: <20240128223447.342493-7-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Arguments passed to the "visualize" subcommand of git-bisect(1) get forwarded to git-log(1). It thus supports the same options as git-log(1) would, but our Bash completion script does not know to handle this. Make completion of porcelain git-log options and option arguments to the visualize subcommand work by calling __git_complete_log_opts when the start of an option to the subcommand is seen (visualize doesn't support any options besides the git-log options). Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 41c76c1246..ae16e742a4 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1490,6 +1490,10 @@ _git_bisect () __gitcomp "--term-good --term-old --term-bad --term-new" return ;; + visualize) + __git_complete_log_opts + return + ;; bad|new|"$term_bad"|good|old|"$term_good"|reset|skip) __git_complete_refs ;; From patchwork Sun Jan 28 22:34:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534671 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D244E4C630 for ; Sun, 28 Jan 2024 22:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481304; cv=none; b=docSSLUfc/AXUA9knQ9ae752+6CqqXzKQN3io3jwWitQNcBmt+vQPfM8RdoNFOJzm7s48sQaJD64gGkHmP0dMB42zuFlSFM1eSTqGMS+n33/J8nv9eLbQCz5MINo8Ru+YiLE0Xxh7n5VcWQIO9cvROjd7pafHIuy+D1wdnEdfsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481304; c=relaxed/simple; bh=7B68u1TjIquVda+MOdxfqkpEZq/LSMv/V7UqU41DR3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PcjJntSt4Si6Li9EYNf5v67xBac9ozh4Mo9U8z5Ea+Q2SN7ZQh50S9DkdLGoaW1tb9xSEKh8lK0yHV/TqJk3UDy+IdROLNLI95Cfim2rI+Rg0F0+rk3jc65End76khaInB1Fb77cUJ0sRm5hvwXSrsM1dzRQI1aypxvXaVNwP6U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WNZTDFb/; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WNZTDFb/" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1d70b0e521eso15965445ad.1 for ; Sun, 28 Jan 2024 14:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481302; x=1707086102; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KXHyY0UZZQOkQ8vGbOM4A+3Bugm3FTpT589PEAW+ZS0=; b=WNZTDFb/d9Koi5nwvhuFiD+wiiUKjnk378PiWvunFdpcmv8N5/PGaBaLAXKEZ9RgHF TNjCSJnCbCgF3YTSwbCJCY9/2zNQJ8v6IY9p50wTYx/EXngWcgfcLAQjlSc+JaXbFAkj EeBp6FXccVSqcysch0YENR9AYA2v+dsJuSrU2C/5DERB8oSxnpQk2ZHD5TW9exWTAAN8 8n0z+Zz0lveutBoVyRdcDnQ8WjR1gFXfFwlXIAyoM+Rty7/lSavIrE8z3csvKOjnNglK AR1qjpfc2qoBQ1ayexOvuF7DjhFefPUpgqLqGfoQsDHXFscE4jCKp3eCb8p5hO+nNzRV cmsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481302; x=1707086102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KXHyY0UZZQOkQ8vGbOM4A+3Bugm3FTpT589PEAW+ZS0=; b=dWd3pC4Gm1LAnT200PPZe2yAQb/lecL7zPPDBSyZb5n5ojTV3fao+4ogig5yplh0WX laMYJSXxkNm0jaWwtpY/HxlzcMl7rvotwZvwWhtvs4AqRvn/i0lTkGoi5ENWhu5KmonI AaDxWqSEYNZxf3Ow+Iux27hLf5+qX+b1eW8gBx1DdgNEjjhWY/Iw4BAP6wP6F+/jTNyo CgVBybsaZ1SD2hBTpXnaxGRQwUlIpfQ2Sab74nBEKG/xYl2b421SyAGaQVu57WqxwGO3 vrIHq4XiFjBawW/LQyLoxSEkilx4u9QFFo6tXPnVaP2wLkZPJ+2eltgfO44FWHXXbDX0 0XYw== X-Gm-Message-State: AOJu0Yw2JuxSwJ7Vw4EI19DFJs7BJFGfMKZb95FNIh6YrEKl0xa3qdLm gEz4wr+rREh5dzdbnsYXMimLGJoFbJgya9Vb/ps7qtnrVs2HZTsH X-Google-Smtp-Source: AGHT+IHBgw75St+LmcOoaXZe6xRX2Sd4aRFc/nrNt0M4pf/lpeZ+JAKp+aquf7h6zVTQcnANNDBujA== X-Received: by 2002:a17:902:e750:b0:1d8:a83e:f81a with SMTP id p16-20020a170902e75000b001d8a83ef81amr4505448plf.139.1706481302163; Sun, 28 Jan 2024 14:35:02 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id p3-20020a170902e34300b001d705b43724sm929248plc.169.2024.01.28.14.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:57 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 731CF52053A; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 7/8] completion: bisect: recognize but do not complete view subcommand Date: Sun, 28 Jan 2024 13:34:46 -0900 Message-ID: <20240128223447.342493-8-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The "view" alias for the visualize subcommand is neither completed nor recognized. It's undesirable to complete it because it's first letters are the same as for visualize, making completion less rather than more efficient without adding much in the way of interface discovery. However, it needs to be recognized in order to enable log option completion for it. Recognize but do not complete the view command by creating and using separate lists of completable_subcommands and all_subcommands. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index ae16e742a4..0cf1a5a393 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1462,12 +1462,19 @@ _git_bisect () # more usual bad/new/good/old because git bisect gives a good error # message if these are given when not in use, and that's better than # silent refusal to complete if the user is confused. - local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help" - local subcommand="$(__git_find_on_cmdline "$subcommands")" + # + # We want to recognize 'view' but not complete it, because it overlaps + # with 'visualize' too much and is just an alias for it. + # + local completable_subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help" + local all_subcommands="$completable_subcommands view" + + local subcommand="$(__git_find_on_cmdline "$all_subcommands")" + if [ -z "$subcommand" ]; then __git_find_repo_path if [ -f "$__git_repo_path"/BISECT_START ]; then - __gitcomp "$subcommands" + __gitcomp "$completable_subcommands" else __gitcomp "replay start" fi @@ -1490,7 +1497,7 @@ _git_bisect () __gitcomp "--term-good --term-old --term-bad --term-new" return ;; - visualize) + visualize|view) __git_complete_log_opts return ;; From patchwork Sun Jan 28 22:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13534672 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB5E14C629 for ; Sun, 28 Jan 2024 22:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481304; cv=none; b=uaU/a8FL+XgdLet8/gdhAQ4cqnfybnuvzSDUCzE55s0X0e8GmV6Hr7ZN0HTunDqBwvMEpR7c7GkvAGGDIQ3xTWTCTXz+WcgX8xIwiK6QEl2IaAXoyhVMv4WSNv5ej3qKnAyLb11Zf1SGfzeZxrtQpkAqfe9OEvHZZLRtsRfaF6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706481304; c=relaxed/simple; bh=hfO1pJTRmo8pyRqIWC89UVk69ySeYY953YxSKoSs1oM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qx0r5gtKd4gbKcRsdGwC2RLT1I33BHNPCC95Kjyenhqnqx9/Jt0v+tdWe44E4Jf7+yakhrj/SjhM3vScn6FEVApTVy35LcDQEsJyQA3SwIKifdGQGB4JeUcC9dTxBUGhIDuYwjPuewukUTUfKobYbRdF7L0zLQ5rf0wHR/MEt3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NJ5MScT1; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NJ5MScT1" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d51ba18e1bso22036315ad.0 for ; Sun, 28 Jan 2024 14:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706481302; x=1707086102; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Dsf0Uhi761DKIrcydqAnu74mD2RbuAw96sc1uH2tMec=; b=NJ5MScT12rxCWDLx8ASWyAGu1qyXiJ4L3785uIgxoKZdBVnsquepLZVFN18mrnvgCx +q6oFiW0FBSdiIam+1cpIk//Nv8JBTGGBBSpo/0jDxqRqQTHTGpbFZakDcyIJcmrTNu/ ZB6u4akZyYzM1VWZVhpT/ke8ca71ard/LoCMeBHLlwqu4BluOF+DMkr79kQkKoiU0wD9 J57DRg0GogOZLhGmyrTiC9Lp9wWn3OHxjIVAQBfzaRMN8rXcrnMRWFrfWsuogNlteg0y U0AqLHifU3fPJrI1t32W0Q4s5YabuFzBEi9ZHosMfxdT2T9JgAM0dS3fJpODfxaZz3lC rmEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706481302; x=1707086102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dsf0Uhi761DKIrcydqAnu74mD2RbuAw96sc1uH2tMec=; b=iQbP1P7tvP3A8sV+zXJG81enoDBxtgwJZsNjYLt4r0WLdaz0xK+GZPgKCqlF3XUAGg v9HZc3o6m5Ol3UGUiD1xZhaxPIkn9b/f2q1Qul5eViJEoWr7ZhINMU1nC9dD8TpoKhZ+ WJ3hyz7AY1oGhFPsQb1D/1FYI7vxauZrZuMIcpxxEmPqJoFZnipwRZFoep+7G2UaVk0c MwVM48QDLZAT4rGomQilT5WBpBGfsbl8LtKYJC8EKmDt5dn/sVOtZ/AKpa/zuE1PdAtF l/F7gO41m5d0U6+BtgWIvWEv6o3Y/t+oZOSrsQ8Fvg5QusWzVIxxzepPanNaSVZWsr4b 5lzA== X-Gm-Message-State: AOJu0YxSUt72WEaTLrZe2h+9cvtKfu1o/sWARCsJ5+BdAx/MkNoquPJh /VPbuQtLavEAMlVkboRox556p69Ha5AsSF8d208rwIH0Cbd1yPjt X-Google-Smtp-Source: AGHT+IHF9D94jtDYAeSKWqAXy5s+WEUbNCJtmVyJLG5MhrGR+NSRwjmNBGWyiI1KUxEgEju6YpYYHg== X-Received: by 2002:a17:902:9f90:b0:1d7:204a:f7fe with SMTP id g16-20020a1709029f9000b001d7204af7femr3809156plq.61.1706481301839; Sun, 28 Jan 2024 14:35:01 -0800 (PST) Received: from brittons-large-Vivobook ([209.112.166.194]) by smtp.gmail.com with ESMTPSA id 4-20020a170902ee4400b001d8ceaa1a5bsm1301600plo.304.2024.01.28.14.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 14:34:57 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 74EF452053B; Sun, 28 Jan 2024 13:34:50 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v4 8/8] completion: add tests for git-bisect Date: Sun, 28 Jan 2024 13:34:47 -0900 Message-ID: <20240128223447.342493-9-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128223447.342493-1-britton.kerin@gmail.com> References: <20240118204323.1113859-1-britton.kerin@gmail.com> <20240128223447.342493-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There aren't any tests for completion of git bisect and it's subcommands. Add tests. --- t/t9902-completion.sh | 135 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index aa9a614de3..698e278450 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1259,6 +1259,141 @@ test_expect_success 'git switch - with no options, complete local branches and u EOF ' +test_expect_success 'git bisect - when not bisecting, complete only replay and start subcommands' ' + test_completion "git bisect " <<-\EOF + replay Z + start Z + EOF +' + +test_expect_success 'git bisect - complete options to start subcommand' ' + test_completion "git bisect start --" <<-\EOF + --term-new Z + --term-bad Z + --term-old Z + --term-good Z + --no-checkout Z + --first-parent Z + EOF +' + +test_expect_success 'setup for git-bisect tests requiring a repo' ' + git init git-bisect && + ( + cd git-bisect && + echo "initial contents" >file && + git add file && + git commit -am "Initial commit" && + git tag initial && + echo "new line" >>file && + git commit -am "First change" && + echo "another new line" >>file && + git commit -am "Second change" && + git tag final + ) +' + +test_expect_success 'git bisect - start subcommand arguments before double-dash are completed as revs' ' + ( + cd git-bisect && + test_completion "git bisect start " <<-\EOF + HEAD Z + final Z + initial Z + master Z + EOF + ) +' + +# Note that these arguments are s, which in practice the fallback +# completion (not the git completion) later ends up completing as paths. +test_expect_success 'git bisect - start subcommand arguments after double-dash are not completed' ' + ( + cd git-bisect && + test_completion "git bisect start final initial -- " "" + ) +' + +test_expect_success 'setup for git-bisect tests requiring ongoing bisection' ' + ( + cd git-bisect && + git bisect start --term-new=custom_new --term-old=custom_old final initial + ) +' + +test_expect_success 'git-bisect - when bisecting all subcommands are candidates' ' + ( + cd git-bisect && + test_completion "git bisect " <<-\EOF + start Z + bad Z + custom_new Z + custom_old Z + new Z + good Z + old Z + terms Z + skip Z + reset Z + visualize Z + replay Z + log Z + run Z + help Z + EOF + ) +' +test_expect_success 'git-bisect - options to terms subcommand are candidates' ' + ( + cd git-bisect && + test_completion "git bisect terms --" <<-\EOF + --term-bad Z + --term-good Z + --term-new Z + --term-old Z + EOF + ) +' + +test_expect_success 'git-bisect - git-log options to visualize subcommand are candidates' ' + ( + cd git-bisect && + # The completion used for git-log and here does not complete + # every git-log option, so rather than hope to stay in sync + # with exactly what it does we will just spot-test here. + test_completion "git bisect visualize --sta" <<-\EOF && + --stat Z + EOF + test_completion "git bisect visualize --summar" <<-\EOF + --summary Z + EOF + ) +' + +test_expect_success 'git-bisect - view subcommand is not a candidate' ' + ( + cd git-bisect && + test_completion "git bisect vi" <<-\EOF + visualize Z + EOF + ) +' + +test_expect_success 'git-bisect - existing view subcommand is recognized and enables completion of git-log options' ' + ( + cd git-bisect && + # The completion used for git-log and here does not complete + # every git-log option, so rather than hope to stay in sync + # with exactly what it does we will just spot-test here. + test_completion "git bisect view --sta" <<-\EOF && + --stat Z + EOF + test_completion "git bisect view --summar" <<-\EOF + --summary Z + EOF + ) +' + test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' ' test_completion "git checkout " <<-\EOF HEAD Z